Xampp on Mac: Permission Denied Error Fix

Updated: October 21, 2022 By: A Goodman Post a comment

After installing Xampp (even the latest version) on your Mac, you may face some errors related to permissions when working with files (uploading files, resizing images…). The most common output you could see will look like this:

failed to open stream: Permission denied in [your-file].php on line [line-number]

Don’t panic. This problem is easy to fix. Here are the steps to follow.

1. Launch your Xampp app then click on the Start button.

2. Click on the Open Terminal button. A dialog may appear to ask you something. Just accept it.

3. Paste the line below into your terminal window then press Return (or Enter).

chmod -R 0777  /opt/lampp/htdocs/


  • Keep your terminal window alive. Don’t kill it.
  • You may need to repeat the steps above when your Mac reboots.

Now, you can execute your PHP script again and check whether your problem is solved. Happy coding.

Notify of
Inline Feedbacks
View all comments

Related Articles