[macos] XAMPP permissions on Mac OS X?

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.

This question is related to macos permissions xampp bitnami xampp-vm

The answer is


What worked for me was,

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

chmod -R 0777 /opt/lampp/htdocs/


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

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

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

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


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


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
    

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.


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


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


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

if you use one line folder or file

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

Examples related to macos

Problems with installation of Google App Engine SDK for php in OS X dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac Could not install packages due to an EnvironmentError: [Errno 13] How do I install Java on Mac OSX allowing version switching? Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Can't compile C program on a Mac after upgrade to Mojave You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) How can I install a previous version of Python 3 in macOS using homebrew? Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"

Examples related to permissions

On npm install: Unhandled rejection Error: EACCES: permission denied Warnings Your Apk Is Using Permissions That Require A Privacy Policy: (android.permission.READ_PHONE_STATE) ActivityCompat.requestPermissions not showing dialog box PostgreSQL: role is not permitted to log in Android 6.0 multiple permissions Storage permission error in Marshmallow Android M Permissions: onRequestPermissionsResult() not being called pip install failing with: OSError: [Errno 13] Permission denied on directory SSH Key: “Permissions 0644 for 'id_rsa.pub' are too open.” on mac changing the owner of folder in linux

Examples related to xampp

Xampp localhost/dashboard phpMyAdmin ERROR: mysqli_real_connect(): (HY000/1045): Access denied for user 'pma'@'localhost' (using password: NO) Is there way to use two PHP versions in XAMPP? Where to find htdocs in XAMPP Mac phpMyAdmin access denied for user 'root'@'localhost' (using password: NO) How to downgrade php from 7.1.1 to 5.6 in xampp 7.1.1? How to turn on/off MySQL strict mode in localhost (xampp)? mysqli_connect(): (HY000/2002): No connection could be made because the target machine actively refused it How to install mcrypt extension in xampp Fatal error: Uncaught Error: Call to undefined function mysql_connect()

Examples related to bitnami

XAMPP permissions on Mac OS X?

Examples related to xampp-vm

XAMPP permissions on Mac OS X?