macos Mac OS X 上的 XAMPP 权限?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9046977/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 08:49:03  来源:igfitidea点击:

XAMPP permissions on Mac OS X?

macospermissionsxamppbitnamixampp-vm

提问by Andrew

I installed XAMPP 1.7.3 on Mac OS X 10.6.8 without changing any defaults.

我在 Mac OS X 10.6.8 上安装了 XAMPP 1.7.3,没有更改任何默认值。

The webserver seems to work okay, but the permissions on the htdocs directory are set to "Read only" for everyone other than system. So (a) I have to provide root password every time I copy in web content, and, more problematic, (b) NetBeans says it can't create a target directory, and doesn't even generate the index.phpfile in the source directory.

网络服务器似乎工作正常,但 htdocs 目录的权限被设置为“只读”,而不是系统。因此,(a) 每次复制 Web 内容时我都必须提供 root 密码,而且问题更大,(b) NetBeans 说它无法创建目标目录,甚至不在index.php源目录中生成文件。

Do I just need to manually change permissions on the htdocsdirectory, or is there some more global XAMPP setting that should be changed? Running NetBeans as root seems a bit extreme.

我只需要手动更改htdocs目录的权限,还是应该更改一些更多的全局 XAMPP 设置?以 root 身份运行 NetBeans 似乎有点极端。

回答by Duello

Tried the above but the option to amend the permission was not available for the htdocs folder,

尝试了上述操作,但是 htdocs 文件夹没有修改权限的选项,

My solution was:

我的解决方案是:

  1. Open applications folder
  2. Locate XAMPP folder
  3. Right click, get info (as described above)
  4. In pop-up window locate the 'sharing & permission' section
  5. Click the 'locked' padlock symbol
  6. Enter admin password
  7. Change 'Everyone' permissions to read & write
  8. In the get info window still, select the 'cog' icon' drop down option at the very bottom and select 'Apply to enclosed items' this will adjust the permission across all sub-folders as well.
  9. Re-lock the padlock symbol
  10. Close the 'Get Info' window.
  1. 打开应用程序文件夹
  2. 找到 XAMPP 文件夹
  3. 右键单击,获取信息(如上所述)
  4. 在弹出窗口中找到“共享和权限”部分
  5. 单击“锁定”挂锁符号
  6. 输入管理员密码
  7. 更改“所有人”的读写权限
  8. 在获取信息窗口中,选择最底部的“cog”图标下拉选项,然后选择“应用于封闭项目”,这也将调整所有子文件夹的权限。
  9. 重新锁定挂锁符号
  10. 关闭“获取信息”窗口。

Task complete, this will now allow you to populate sub-folders within the htdocs folder as needed to populate your website(s).

任务完成,这将允许您根据需要填充 htdocs 文件夹中的子文件夹以填充您的网站。

回答by Bryan Kimani

Make sure the XAMPP appis running then:

确保XAMPP app正在运行:

  1. Under GeneralTab, in XAMPP app, click Open Terminal
  2. A terminal will be launched with something like, root@debian:~#, on the terminal shell
  3. on that terminal shell, type, chmod -R 0777 /opt/lampp/htdocs/and enter
  4. Exit, the terminal and you be good to go
  1. GeneralTab 下,在 中XAMPP app,单击Open Terminal
  2. 终端将root@debian:~#在终端外壳上以类似的东西启动
  3. 在那个终端外壳上,输入,chmod -R 0777 /opt/lampp/htdocs/然后enter
  4. Exit,终端和你很高兴去

回答by Prashanth Sams

For latest OSX versions,

对于最新的 OSX 版本,

  1. Right click on the folder
  2. Select Get Info
  3. Expand the Sharing & Permissionsection
  4. Unlock the folder by clicking lock icon on bottom right-corner
  5. Now, select the user list and enable Read & Writeprivilege for the users
  6. Click on the +icon to add username
  7. Finally click settings iconand select Apply to enclosed items...

    enter image description here

  1. 右键单击文件夹
  2. 选择 Get Info
  3. 展开Sharing & Permission部分
  4. 单击右下角的锁定图标解锁文件夹
  5. 现在,选择用户列表并Read & Write为用户启用权限
  6. 点击+图标添加用户名
  7. 最后点击settings icon选择Apply to enclosed items...

    在此处输入图片说明

回答by Johnny

For new XAMPP-VMfor Mac OS X,
I change the ownership to daemonuser and solve the problem.

对于XAMPP-VMMac OS X 的新用户,
我将所有权更改为daemon用户并解决了问题。

For example,

例如,

$ chown -R daemon:daemon /opt/lampp/htdocs/hello-laravel/storage

回答by Denis Kutlubaev

If you use Mac OS X and XAMPP, let's assume that your folder with your site or API located in folder /Applications/XAMPP/xamppfiles/htdocs/API. Then you can grant access like this:

如果您使用 Mac OS X 和 XAMPP,假设您的站点或 API 所在的文件夹位于文件夹 /Applications/XAMPP/xamppfiles/htdocs/API 中。然后你可以像这样授予访问权限:

$ chmod 777 /Applications/XAMPP/xamppfiles/htdocs/API

And now open the page inside the folder:

现在打开文件夹内的页面:

http://localhost/API/index.php

回答by Gabriel Nwoffiah II

Go to htdocs folder, right click, get info, click to unlock the padlock icon, type your password, under sharing permission change the priviledge for everyone to read & write, on the cog wheel button next to the + and - icons, click and select apply to all enclosed items, click to accept security request, close get info. Now xampp can write and read your root folder.

转到 htdocs 文件夹,右键单击,获取信息,单击以解锁挂锁图标,输入您的密码,在共享权限下更改每个人的读写权限,在 + 和 - 图标旁边的齿轮按钮上,单击和选择适用于所有封闭项目,单击接受安全请求,关闭获取信息。现在 xampp 可以写入和读取您的根文件夹。

Note:

笔记:

  1. If you copy a new folder into the htdocs after this, you need to repeat the process for that folder to have write permission.

  2. When you move your files to the live server, you need to also chmod the appropriate files & folders on the server as well.

  1. 如果在此之后将一个新文件夹复制到 htdocs 中,则需要对该文件夹重复该过程以获得写入权限。

  2. 当您将文件移动到实时服务器时,您还需要对服务器上的相应文件和文件夹进行 chmod。

回答by Cameron Hudson

Following the instructions from this page,

按照此页面的说明,

  1. Open the XAMPP control panel (cmd-space, then enter manager-osx.app).
  2. Select Manage Serverstab -> select Apache Web Server-> click Configure.
  3. Click Open Conf File. Provide credentials if asked.
  4. Change

    <IfModule unixd_module>
    #
    # If you wish httpd to run as a different user or group, you must run
    # httpd as root initially and it will switch.  
    #
    # User/Group: The name (or #number) of the user/group to run httpd as.
    # It is usually good practice to create a dedicated user and group for
    # running httpd, as with most system services.
    #
    User daemon
    Group daemon
    </IfModule>
    

    to

    <IfModule unixd_module>
    #
    # If you wish httpd to run as a different user or group, you must run
    # httpd as root initially and it will switch.  
    #
    # User/Group: The name (or #number) of the user/group to run httpd as.
    # It is usually good practice to create a dedicated user and group for
    # running httpd, as with most system services.
    #
    User your_username
    Group staff
    </IfModule>
    
  5. Save and close.

  6. Using the XAMPP control panel, restart Apache.
  7. Navigate to the document root of your server and make yourself the owner. The default is /Applications/XAMPP/xamppfiles/htdocs.

    $ cd your_document_root
    $ sudo chown -R your_username:staff .
    
  1. 打开 XAMPP 控制面板(cmd-space,然后输入manager-osx.app)。
  2. 选择Manage Servers选项卡 -> 选择Apache Web Server-> 单击Configure
  3. 单击Open Conf File。如果要求,请提供凭据。
  4. 改变

    <IfModule unixd_module>
    #
    # If you wish httpd to run as a different user or group, you must run
    # httpd as root initially and it will switch.  
    #
    # User/Group: The name (or #number) of the user/group to run httpd as.
    # It is usually good practice to create a dedicated user and group for
    # running httpd, as with most system services.
    #
    User daemon
    Group daemon
    </IfModule>
    

    <IfModule unixd_module>
    #
    # If you wish httpd to run as a different user or group, you must run
    # httpd as root initially and it will switch.  
    #
    # User/Group: The name (or #number) of the user/group to run httpd as.
    # It is usually good practice to create a dedicated user and group for
    # running httpd, as with most system services.
    #
    User your_username
    Group staff
    </IfModule>
    
  5. 保存并关闭。

  6. 使用 XAMPP 控制面板,重新启动 Apache。
  7. 导航到服务器的文档根目录并让自己成为所有者。默认为/Applications/XAMPP/xamppfiles/htdocs

    $ cd your_document_root
    $ sudo chown -R your_username:staff .
    

回答by Asil ARSLAN

if you use one line folder or file

如果您使用一行文件夹或文件

chmod 755 $(find /yourfolder -type d)
chmod 644 $(find /yourfolder -type f)

回答by Thusal Hettiarachchi

What worked for me was,

对我有用的是,

  • Open Terminal from the XAMPP app,
  • type in this,
  • 从 XAMPP 应用程序打开终端,
  • 输入这个,

chmod -R 0777 /opt/lampp/htdocs/

chmod -R 0777 /opt/lampp/htdocs/

回答by rickb

You can also simply change Apache Conf file to a different User Name and keep the group:

您也可以简单地将 Apache Conf 文件更改为不同的用户名并保留组:

Apache Conf Applications/Xammp/etc/..

Apache Conf 应用程序/Xammp/etc/..

User 'User' = your user name in Mac os x.

User 'User' = 您在 Mac os x 中的用户名。

Group daemon

组守护进程

sudo chown -R 'User':daemon ~/Sites/wordpress 

sudo chmod -R g+w ~/Sites/wordpress