Mac OS X 上的 XAMPP 权限?

发布于 2024-12-29 06:51:12 字数 306 浏览 0 评论 0原文

我在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

梦旅人picnic 2025-01-05 06:51:12

尝试了上述方法,但修改权限的选项不适用于 htdocs 文件夹,

我的解决方案是:

  1. 打开应用程序文件夹
  2. 找到 XAMPP 文件夹
  3. 右键单击​​,获取信息(如上所述)
  4. 在弹出窗口中找到“共享和” 输入
  5. 单击“锁定”挂锁符号
  6. 管理员密码
  7. 将“所有人”权限更改为读取和读取权限 仍然在
  8. 获取信息窗口中,选择最底部的“齿轮”图标下拉选项,然后选择“应用到包含的项目”,这也将调整所有子文件夹的权限。
  9. 重新锁定挂锁符号
  10. 关闭“获取信息”窗口。

任务完成,现在您可以根据需要填充 htdocs 文件夹中的子文件夹,以填充您的网站。

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

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.

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

情深缘浅 2025-01-05 06:51:12

确保 XAMPP 应用程序 正在运行:

  1. 常规 选项卡下的 XAMPP 应用程序 中,单击打开终端
  2. 终端将使用类似 root@debian:~# 的内容启动,在
  3. 该终端 shell 上输入 chmod -R 0777 /opt/lampp/htdocs/然后输入
  4. 退出,终端就可以走了

Make sure the XAMPP app is running then:

  1. Under General Tab, 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
嘦怹 2025-01-05 06:51:12

对于最新的 OSX 版本,

  1. 右键单击该文件夹
  2. 选择获取信息
  3. 展开共享和共享权限部分
  4. 通过单击右下角的锁定图标解锁文件夹
  5. 现在,选择用户列表并启用读取和权限 部分用户的写入权限
  6. 单击+图标添加用户名
  7. 最后单击设置图标并选择应用于随附的项目...

    在此处输入图像描述

For latest OSX versions,

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

    enter image description here

沫雨熙 2025-01-05 06:51:12

按照 的说明进行操作在此页面

  1. 打开 XAMPP 控制面板(cmd-空格键,然后输入 manager-osx.app)。
  2. 选择管理服务器选项卡 ->选择Apache Web Server ->单击配置
  3. 单击打开配置文件。如果要求,请提供凭据。
  4. 改变

    ;
    #
    # 如果您希望 httpd 作为不同的用户或组运行,则必须运行
    # httpd 最初以 root 身份运行,它将切换。  
    #
    # 用户/组:运行 httpd 的用户/组的名称(或#number)。
    # 通常最好的做法是创建专门的用户和组
    # 与大多数系统服务一样运行 httpd。
    #
    用户守护进程
    群组守护进程
    
    

    ;
    #
    # 如果您希望 httpd 作为不同的用户或组运行,则必须运行
    # httpd 最初以 root 身份运行,它将切换。  
    #
    # 用户/组:运行 httpd 的用户/组的名称(或#number)。
    # 通常最好的做法是创建专门的用户和组
    # 与大多数系统服务一样运行 httpd。
    #
    用户 your_username
    集团人员
    
    
  5. 保存并关闭。

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

    $ cd your_document_root
    $ sudo chown -R your_username:staff 。
    
  8. 导航到 xamppfiles 目录并更改 logstemp 目录的权限。

    $ cd /Applications/XAMPP/xamppfiles
    $ sudo chown -R 你的用户名:员工日志
    $ sudo chown -R 你的用户名:员工临时工
    
  9. 为了能够使用phpmyadmin,您必须更改config.inc.php的权限。

    $ cd /Applications/XAMPP/xamppfiles/phpmyadmin
    $ sudo chown your_username:staff config.inc.php
    

Following the instructions from this page,

  1. Open the XAMPP control panel (cmd-space, then enter manager-osx.app).
  2. Select Manage Servers tab -> 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 .
    
  8. Navigate to the xamppfiles directory and change the permission for logs and temp directory.

    $ cd /Applications/XAMPP/xamppfiles
    $ sudo chown -R your_username:staff logs
    $ sudo chown -R your_username:staff temp
    
  9. To be able to use phpmyadmin you have to change the permissions for config.inc.php.

    $ cd /Applications/XAMPP/xamppfiles/phpmyadmin
    $ sudo chown your_username:staff config.inc.php
    
野鹿林 2025-01-05 06:51:12

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

例如,

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

For new XAMPP-VM for Mac OS X,
I change the ownership to daemon user and solve the problem.

For example,

$ chown -R daemon:daemon /opt/lampp/htdocs/hello-laravel/storage
っ左 2025-01-05 06:51:12

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

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

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

http://localhost/API/index.php

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:

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

And now open the page inside the folder:

http://localhost/API/index.php
恍梦境° 2025-01-05 06:51:12

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

注意:

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

  2. 当您将文件移动到实时服务器时,您还需要 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:

  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.

没︽人懂的悲伤 2025-01-05 06:51:12

MAC OS Catalina Xampp 的最佳解决方案

  1. 打开 Finder
  2. Cmd + shift + C
  3. Macintosh HD =>用户 => 复制 {用户名}

  4. 打开/Applications/XAMPP/xamppfiles/etc/httpd.conf

    找到用户守护进程编辑守护进程=> {username}

  5. Xampp 管理服务器=>重新启动所有

如果你在phpMyAdmin中遇到问题:

1. Browser (Chrome) restart

Goodluck

Best solution for MAC OS Catalina Xampp

  1. Open Finder
  2. Press Cmd + shift + C
  3. Macintosh HD => Users => copy {username}

  4. Open /Applications/XAMPP/xamppfiles/etc/httpd.conf

    Find User daemon edit daemon => {username}

  5. Xampp Manage Server => Restart all

If you encounter problems in phpMyAdmin:

1. Browser (Chrome) restart

Goodluck

谁与争疯 2025-01-05 06:51:12

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

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

if you use one line folder or file

chmod 755 $(find /yourfolder -type d)
chmod 644 $(find /yourfolder -type f)
习ぎ惯性依靠 2025-01-05 06:51:12

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

Apache Conf Applications/Xammp/etc/..

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

群组守护进程

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

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

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

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

sudo chmod -R g+w ~/Sites/wordpress
岁月蹉跎了容颜 2025-01-05 06:51:12

对我有用的是,

  • 从 XAMPP 应用程序打开终端,
  • 输入

chmod -R 0777 /opt/lampp/htdocs/

What worked for me was,

  • Open Terminal from the XAMPP app,
  • type in this,

chmod -R 0777 /opt/lampp/htdocs/

開玄 2025-01-05 06:51:12

如果您在新的 XAMPP-VM 版本的 MacOS 上运行页面,则必须将守护程序设置为用户和组。 在这里您可以找到一个很棒的分步说明,其中包含来自 aXfon 的屏幕截图,说明如何执行此操作。

由于 XAMPP-VM 下的 htdocs 文件夹将作为外部卷安装,因此您必须以已安装卷的根目录 (root@debian) 的身份执行此操作。这可以通过 XAMPP-VM GUI 来实现:
查看屏幕截图

一旦您以已安装卷的根用户身份运行,您就可以按照上述方法更改文件权限:

chown -R daemon:daemon /opt/lampp/htdocs/FOLDER_OF_YOUR_PAGE

源(带有分步说明):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:

chown -R daemon:daemon /opt/lampp/htdocs/FOLDER_OF_YOUR_PAGE

Source (w/ step-by-step illustration): aXfon

晨曦÷微暖 2025-01-05 06:51:12

通过更改安装在 MAC XAMPP-VM 上的 apps/wordpress 文件夹中的文件权限,解决了 Bitnami XAMPP 中的 WordPress 文件系统权限问题,

如下图所示。

输入图片此处描述

sudo chown -R bitnami:daemon TARGET # [ Replace "TARGET" with your file/folder path ]
find TARGET -type d -print0 | xargs -0 chmod 775
find TARGET -type f -print0 | xargs -0 chmod 664
chmod 640 TARGET/wp-config.php

来源: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.

enter image description here

sudo chown -R bitnami:daemon TARGET # [ Replace "TARGET" with your file/folder path ]
find TARGET -type d -print0 | xargs -0 chmod 775
find TARGET -type f -print0 | xargs -0 chmod 664
chmod 640 TARGET/wp-config.php

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.

NOTE: This should be done only in your development environment.
Production build permissions are different & above doesn't apply

街道布景 2025-01-05 06:51:12

以上仅适用于某些目录,但不适用于所有根文件。要更改根文件权限,请打开 Xampp 应用程序,在 Xampp 应用程序中单击“打开终端”按钮。一旦出现,请执行以下操作:

 - go to root directory: cd ..  
 - got to directory where lamp is located: cd opt
 - change lampp permissions: chown -R bitnami:root lampp

注意:您可以将 bitnami 替换为您的用户,并将 root 替换为您的组。


作为适用于某些文件的第二个替代方案:

转到查找器中的用户文件夹并找到 .bitnami 隐藏文件夹,访问其中的 xampp 文件夹并更改权限:

  • /Users/username/.bitnami/stackman/machines/xampp
  • 右键单击​​ xampp机器下的文件夹并更改读取权限写入
  • 适用于带有“cog icon”的封闭文件夹

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:

 - go to root directory: cd ..  
 - got to directory where lamp is located: cd opt
 - change lampp permissions: chown -R bitnami:root lampp

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:

  • /Users/username/.bitnami/stackman/machines/xampp
  • right click xampp folder under machines and change permissions to read & write
  • apply to enclosing folders with "cog icon"
听,心雨的声音 2025-01-05 06:51:12

如果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 的所有者和组更改为您的用户名:组。

在线程中有说明,简而言之:

  1. 打开 httpd.conf (管理服务器 > 配置 >打开 Conf 文件)并将用户和组“daemon”替换为您的用户和组。 (类似于“用户守护程序”和“组守护程序”)。
  2. 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:

  1. open the httpd.conf (Manage Server > Configure > Open Conf File) and replace the user and group "daemon" with yours. (Something like "User daemon" and "Group daemon").
  2. sudo chown -R admin:admin /path/to/xampp_root_directory
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文