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
XAMPP permissions on Mac OS X?
提问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.php
file in the source directory.
网络服务器似乎工作正常,但 htdocs 目录的权限被设置为“只读”,而不是系统。因此,(a) 每次复制 Web 内容时我都必须提供 root 密码,而且问题更大,(b) NetBeans 说它无法创建目标目录,甚至不在index.php
源目录中生成文件。
Do I just need to manually change permissions on the htdocs
directory, 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:
我的解决方案是:
- Open applications folder
- Locate XAMPP folder
- Right click, get info (as described above)
- In pop-up window locate the 'sharing & permission' section
- Click the 'locked' padlock symbol
- Enter admin password
- Change 'Everyone' permissions to read & write
- 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.
- Re-lock the padlock symbol
- Close the 'Get Info' window.
- 打开应用程序文件夹
- 找到 XAMPP 文件夹
- 右键单击,获取信息(如上所述)
- 在弹出窗口中找到“共享和权限”部分
- 单击“锁定”挂锁符号
- 输入管理员密码
- 更改“所有人”的读写权限
- 在获取信息窗口中,选择最底部的“cog”图标下拉选项,然后选择“应用于封闭项目”,这也将调整所有子文件夹的权限。
- 重新锁定挂锁符号
- 关闭“获取信息”窗口。
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 app
is running then:
确保XAMPP app
正在运行:
- Under
General
Tab, inXAMPP app
, clickOpen Terminal
- A terminal will be launched with something like,
root@debian:~#
, on the terminal shell - on that terminal shell, type,
chmod -R 0777 /opt/lampp/htdocs/
andenter
Exit
, the terminal and you be good to go
- 在
General
Tab 下,在 中XAMPP app
,单击Open Terminal
- 终端将
root@debian:~#
在终端外壳上以类似的东西启动 - 在那个终端外壳上,输入,
chmod -R 0777 /opt/lampp/htdocs/
然后enter
Exit
,终端和你很高兴去
回答by Prashanth Sams
For latest OSX versions,
对于最新的 OSX 版本,
- Right click on the folder
- Select
Get Info
- Expand the
Sharing & Permission
section - Unlock the folder by clicking lock icon on bottom right-corner
- Now, select the user list and enable
Read & Write
privilege for the users - Click on the
+
icon to add username Finally click
settings icon
and selectApply to enclosed items...
回答by Johnny
For new XAMPP-VM
for Mac OS X,
I change the ownership to daemon
user and solve the problem.
对于XAMPP-VM
Mac 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:
笔记:
If you copy a new folder into the htdocs after this, you need to repeat the process for that folder to have write permission.
When you move your files to the live server, you need to also chmod the appropriate files & folders on the server as well.
如果在此之后将一个新文件夹复制到 htdocs 中,则需要对该文件夹重复该过程以获得写入权限。
当您将文件移动到实时服务器时,您还需要对服务器上的相应文件和文件夹进行 chmod。
回答by Cameron Hudson
Following the instructions from this page,
按照此页面的说明,
- Open the XAMPP control panel (cmd-space, then enter
manager-osx.app
). - Select
Manage Servers
tab -> selectApache Web Server
-> clickConfigure
. - Click
Open Conf File
. Provide credentials if asked. 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>
Save and close.
- Using the XAMPP control panel, restart Apache.
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 .
- 打开 XAMPP 控制面板(cmd-space,然后输入
manager-osx.app
)。 - 选择
Manage Servers
选项卡 -> 选择Apache Web Server
-> 单击Configure
。 - 单击
Open Conf File
。如果要求,请提供凭据。 改变
<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>
保存并关闭。
- 使用 XAMPP 控制面板,重新启动 Apache。
导航到服务器的文档根目录并让自己成为所有者。默认为
/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