Mac OS X 上的 XAMPP 权限?
我在 Mac OS X 10.6.8 上安装了 XAMPP 1.7.3,没有更改任何默认值。
网络服务器似乎工作正常,但 htdocs 目录的权限设置为除系统之外的所有人的“只读”。因此,(a) 每次复制 Web 内容时,我都必须提供 root 密码,而且问题更大,(b) NetBeans 说它无法创建目标目录,甚至不生成 index.php源目录中的
文件。
我是否只需要手动更改 htdocs
目录的权限,还是应该更改一些更全局的 XAMPP 设置?以 root 身份运行 NetBeans 似乎有点极端。
I installed XAMPP 1.7.3 on Mac OS X 10.6.8 without changing any defaults.
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.
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
尝试了上述方法,但修改权限的选项不适用于 htdocs 文件夹,
我的解决方案是:
任务完成,现在您可以根据需要填充 htdocs 文件夹中的子文件夹,以填充您的网站。
Tried the above but the option to amend the permission was not available for the htdocs folder,
My solution was:
Task complete, this will now allow you to populate sub-folders within the htdocs folder as needed to populate your website(s).
确保
XAMPP 应用程序
正在运行:常规
选项卡下的XAMPP 应用程序
中,单击打开终端
root@debian:~#
的内容启动,在chmod -R 0777 /opt/lampp/htdocs/
然后输入
退出
,终端就可以走了Make sure the
XAMPP app
is running then:General
Tab, inXAMPP app
, clickOpen Terminal
root@debian:~#
, on the terminal shellchmod -R 0777 /opt/lampp/htdocs/
andenter
Exit
, the terminal and you be good to go对于最新的 OSX 版本,
获取信息
共享和共享权限
部分读取和权限
部分用户的写入权限+
图标添加用户名最后单击
设置图标
并选择应用于随附的项目...
For latest OSX versions,
Get Info
Sharing & Permission
sectionRead & Write
privilege for the users+
icon to add usernameFinally click
settings icon
and selectApply to enclosed items...
按照 的说明进行操作在此页面,
manager-osx.app
)。管理服务器
选项卡 ->选择Apache Web Server
->单击配置
。打开配置文件
。如果要求,请提供凭据。改变
至
保存并关闭。
导航到服务器的文档根目录并使自己成为所有者。默认值为
/Applications/XAMPP/xamppfiles/htdocs
。导航到
xamppfiles
目录并更改logs
和temp
目录的权限。为了能够使用phpmyadmin,您必须更改
config.inc.php
的权限。Following the instructions from this page,
manager-osx.app
).Manage Servers
tab -> selectApache Web Server
-> clickConfigure
.Open Conf File
. Provide credentials if asked.Change
to
Save and close.
Navigate to the document root of your server and make yourself the owner. The default is
/Applications/XAMPP/xamppfiles/htdocs
.Navigate to the
xamppfiles
directory and change the permission forlogs
andtemp
directory.To be able to use phpmyadmin you have to change the permissions for
config.inc.php
.对于适用于 Mac OS X 的新
XAMPP-VM
,我将所有权更改为
daemon
用户并解决了问题。例如,
For new
XAMPP-VM
for Mac OS X,I change the ownership to
daemon
user and solve the problem.For example,
如果您使用 Mac OS X 和 XAMPP,我们假设您的站点或 API 文件夹位于文件夹 /Applications/XAMPP/xamppfiles/htdocs/API 中。然后您可以像这样授予访问权限:
现在打开文件夹内的页面:
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:
And now open the page inside the folder:
转到 htdocs 文件夹,右键单击,获取信息,单击解锁挂锁图标,输入密码,在共享权限下更改每个人的阅读和阅读权限。写入,在 + 和 - 图标旁边的齿轮按钮上,单击并选择应用到所有包含的项目,单击接受安全请求,关闭获取信息。现在 xampp 可以写入和读取您的根文件夹。
注意:
如果在此之后将新文件夹复制到 htdocs 中,则需要重复该过程以使该文件夹具有写入权限。
当您将文件移动到实时服务器时,您还需要 chmod 适当的文件和文件。服务器上的文件夹也是如此。
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.
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.
MAC OS Catalina Xampp 的最佳解决方案
Finder
Cmd + shift + C
Macintosh HD =>用户 =>
复制 {用户名}打开
/Applications/XAMPP/xamppfiles/etc/httpd.conf
找到
用户守护进程
编辑守护进程=> {username}
Xampp
管理服务器=>重新启动所有
如果你在phpMyAdmin中遇到问题:
Goodluck
Best solution for MAC OS Catalina Xampp
Finder
Cmd + shift + C
Macintosh HD => Users =>
copy {username}Open
/Applications/XAMPP/xamppfiles/etc/httpd.conf
Find
User daemon
editdaemon => {username}
Xampp
Manage Server => Restart all
If you encounter problems in phpMyAdmin:
Goodluck
如果您使用一行文件夹或文件
if you use one line folder or file
您还可以简单地将 Apache Conf 文件更改为不同的用户名并保留组:
Apache Conf Applications/Xammp/etc/..
用户“User”=您在 Mac os x 中的用户名。
群组守护进程
You can also simply change Apache Conf file to a different User Name and keep the group:
Apache Conf Applications/Xammp/etc/..
User 'User' = your user name in Mac os x.
Group daemon
对我有用的是,
chmod -R 0777 /opt/lampp/htdocs/
What worked for me was,
chmod -R 0777 /opt/lampp/htdocs/
如果您在新的 XAMPP-VM 版本的 MacOS 上运行页面,则必须将守护程序设置为用户和组。 在这里您可以找到一个很棒的分步说明,其中包含来自 aXfon 的屏幕截图,说明如何执行此操作。
由于 XAMPP-VM 下的 htdocs 文件夹将作为外部卷安装,因此您必须以已安装卷的根目录 (root@debian) 的身份执行此操作。这可以通过 XAMPP-VM GUI 来实现:
查看屏幕截图。
一旦您以已安装卷的根用户身份运行,您就可以按照上述方法更改文件权限:
源(带有分步说明):aXfon
If you are running your page on the new XAMPP-VM version of MacOS you will have to set daemon as user and as group. Here you can find a great step-by-step illustration with screenshots from aXfon on how to do this.
As the htdocs folder under XAMPP-VM will be mounted as external volume, you'll have to do this as root of the mounted volume (root@debian). This can be achieved through the XAMPP-VM GUI:
See screenshot.
Once you are running as root of the mounted volume you can as described above change the file permission using:
Source (w/ step-by-step illustration): aXfon
通过更改安装在 MAC XAMPP-VM 上的
apps/wordpress
文件夹中的文件权限,解决了 Bitnami XAMPP 中的 WordPress 文件系统权限问题,如下图所示。
来源:bitnami
TARGET - 替换已安装文件系统 WordPress 路径的占位符,例如:
'1.1.1.1/lampp/apps/wordpress'
现在您可以在 VS-Code 或您选择的任何开发者编辑器中编辑您的主题。
This Solved WordPress Filesystem Permissions in Bitnami XAMPP
By changing the file permissions in
apps/wordpress
folder mounted on MAC XAMPP-VM shown in the below screenshot.Source: bitnami
TARGET - Replace placeholder for your mounted filesystem wordpress path eg:
'1.1.1.1/lampp/apps/wordpress'
Now you can edit your themes in VS-Code or any developer editor of your choice.
以上仅适用于某些目录,但不适用于所有根文件。要更改根文件权限,请打开 Xampp 应用程序,在 Xampp 应用程序中单击“打开终端”按钮。一旦出现,请执行以下操作:
注意:您可以将 bitnami 替换为您的用户,并将 root 替换为您的组。
作为适用于某些文件的第二个替代方案:
转到查找器中的用户文件夹并找到 .bitnami 隐藏文件夹,访问其中的 xampp 文件夹并更改权限:
The above worked only for some directories but didn't for all root files. To change root files permissions, open Xampp app, within Xampp app click button 'open terminal'. once there do the following:
note: you can replace bitnami with your user, and root with your group.
as a second alternative that worked for some files:
go to your users folder in finder and find the .bitnami hidden folder, access xampp folder within it and change permissions:
如果xampp有默认设置,那就相当混乱了。我稍微扩展一下这个话题。
问题在于目录和文件权限(它们控制用户是否可以读取、写入或执行(访问和运行)文件和目录。)
您以 username:group 身份登录(将用户名和组替换为您的用户名,例如 username=joedoe,group=admin,因此 joedoe:admin),并且 Apache 以 daemon:daemon 身份运行(即 user=daemon 和 group=daemon)。
所以问题不仅在于读、写、执行...,还在于所有者和组。
当程序保存文件时(例如PHP file_put_content),将以权限644保存并属于到 daemon:daemon (你可以在终端
ls -al
中看到。为了能够保存在目录中,该目录必须有允许这样做的权限。在这个线程 777 中多次建议,最后一个“7”属于“其他”(所有者、组、其他)在这里负责,因为您和 httpd/Apache 是属于不同组的不同用户即使您将文件保存在该目录中,您仍然可能会遇到问题。例如,无法使用您的编辑器删除程序在该目录中写入的文件,因为它们具有 644 权限并且不属于您。
了解问题后,您就知道如何解决它。所有文件到守护进程:守护进程可能会工作,如果你请勿在编辑器中处理该文件。此外,许多其他事情也会出现问题。例如,您可能想要安装与 XAMPP 一起使用的 brew(比方说 xdebug)...您使用 brew 安装的内容将属于 user:group 并且您有 XAMPP 和 daemon:daemon...我相信反之亦然会更好。
将 XAMPP 的所有者和组更改为您的用户名:组。
在线程中有说明,简而言之:
httpd.conf
(管理服务器 > 配置 >打开 Conf 文件)并将用户和组“daemon”替换为您的用户和组。 (类似于“用户守护程序”和“组守护程序”)。sudo chown -R admin:admin /path/to/xampp_root_directory
If the xampp has the default settings, it is quite a mess. I expand a little the topic.
The problem is with directory and file permissions (they control whether users can read, write, or execute - access and run - files and directories.)
You are logged in as username:group (replace username and group with yours, for example username=joedoe, group=admin, so joedoe:admin) and the Apache runs as daemon:daemon (i.e. user=daemon and group=daemon).
So the problems is not only the read, write, execute... but also owner and group.
When a program save a file (for example, PHP file_put_content), will be saved with permission 644 and belong to daemon:daemon (you can see in terminal
ls -al
. To be able to save in a directory, the directory must have a permission to allow this. It was suggested in this thread 777 so many times, the last "7" belonging to "others" (owner, group, others) is responsible here as you and httpd/Apache are different users belonging to different groups.Even if you save the file in that directory, you may still run into problems. In this example, you will not be able, for example, to use your editor to delete the files written in that directory by the program because they will have the permission 644 and do not belong to you.
Understanding the problem, you know how to fix it. Changing the ownership of all files to daemon:daemon may work if you do not work on that files in an editor. In addition, many other things will be problematic. For example, you may want to install something with brew (let's say xdebug) that works with XAMPP... what you install with brew will belong to user:group and you have XAMPP with daemon:daemon... I believe that is much better to do it the other way around.
Change the owner and group of XAMPP to your username:group.
In the thread there are instructions, on short:
httpd.conf
(Manage Server > Configure > Open Conf File) and replace the user and group "daemon" with yours. (Something like "User daemon" and "Group daemon").sudo chown -R admin:admin /path/to/xampp_root_directory