danielschnoll
danielschnoll

Reputation: 3604

MacOS XAMPP Access Forbidden Error 403 - You don't have permission to access the requested directory

I have some PHP web apps running off XAMPP 7.4.1 on macOS 10.15. XAMPP has worked for me in the past. I got my dev environment screwed up because 32 bit apps sh*t the bed with Catalina, and my old XAMPP installation didn't open. I got my VirtualHosts set back up, but now when I try to access one of my sites I get the following error.

Access forbidden!
You don't have permission to access the requested directory. There is 
either no index document or the directory is read-protected.

If you think this is a server error, please contact the webmaster.

Error 403

My virtual hosts look like the following:

# localhost
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs"
    <Directory "/Applications/XAMPP/xamppfiles/htdocs">
        Options Indexes FollowSymLinks Includes execCGI
        AllowOverride All
        Require all granted
    </Directory>
</VirtualHost>

#####################
# PERSONAL PROJECTS #
#####################

# Dunsparce.net
<VirtualHost *:80>
    ServerName dunsparce.net
    DocumentRoot "/Users/danielschnoll/Documents/Projects/Dunsparce.net"
    <Directory "/Users/danielschnoll/Documents/Projects/Dunsparce.net">
        Options Indexes FollowSymLinks Includes ExecCGI
        AllowOverride All
        Require all granted
    </Directory>
    ErrorLog "logs/dunsparce-error_log"
</VirtualHost>

I have more VirtualHosts listed and they all follow the same format. I have Require all granted on each one, as well as the Allow Override All and the Options... line. Like I said at the start of the post, they all worked in the past. I also have the # Include uncommented in my httpd.conf file, though I'm pretty sure Access Forbidden error is completely unrelated to it.

Any ideas?

Upvotes: 9

Views: 27097

Answers (6)

Mahmoud Abdelsattar
Mahmoud Abdelsattar

Reputation: 1469

Only one solution worked for me.

Go to the file /Applications/XAMPP/xamppfiles/etc/httpd.conf, edit the part:

<Directory />
    AllowOverride none
    Require all denied 
</Directory>

To:

<Directory />
    AllowOverride none
    Require all granted
</Directory>

And don't forget to restart the Apache Web Server from the application.

Upvotes: 1

masoud mohammadi
masoud mohammadi

Reputation: 21

Follow below steps:

  • Go to htdocs folder
  • Right click on the folder and get info
  • Go to Sharing & Permissions: and >>> add your user
  • Your user : read & write

Upvotes: 2

durje
durje

Reputation: 135

Changing the User group permissions didn't work for me, but creating a Symbolic link to my working directory worked:

cd /opt/lampp/htdocs
ln -s /home/user/Projects/www www

Then in /opt/lampp/etc/httpd.conf

DocumentRoot "/opt/lampp/htdocs/www"

Upvotes: 0

Ashish
Ashish

Reputation: 726

How to Fix XAMPP Error 403

Step 1: Open the Volumes tab in the XAMPP app

First, open the XAMPP app on your Mac and navigate into the Volumes tab

Step 2: Click on 'Mount'

Next, you're going to mount the opt/lampp directory onto your computer.

Step 3: Click on 'Explore'

Step 4: Open the 'etc' folder

By clicking on explore your app should have opened the lampp directory. In it you'll see many folders and files. Click on the one named 'etc'.

Step 5: Open the 'extra' folder

Step 6: Open the 'httpd-xampp.conf' file

Step 7: Find the AuthConfig requirements code

Search for 'phpmyadmin' in the httpd-xampp.conf code and find the following section:

httpd-xampp phpmyadmin require local

Step 8: Change 'Require local' to 'Require all granted'

This is the step that will fix the 403 error. Change the line of code to replace 'Require local' with 'Require all granted'. Then save your file.

Step 9: Restart all services

Navigate back to the XAMPP app and click on 'Services', then 'Restart all'. This will restart all of the services. You'll notice the status lights turn yellow and eventually return back to green.

Step 10: Refresh the phpMyAdmin page

The last step is to refresh the phpMyAdmin page you had open earlier.

If you closed it, no problem, just return to the General tab on your XAMPP app and click 'Go to Application'. That will open the dashboard in your browser where you can again navigate to the phpMyAdmin page.

Upvotes: 1

Tristanisginger
Tristanisginger

Reputation: 2691

If you landed here after an Upgrade to MAC OS my problem was solved when I moved the web files out of the /Documents/ folder.

Upvotes: 4

danielschnoll
danielschnoll

Reputation: 3604

I wound up having to edit httpd.conf again. There’s a section for User group permissions. By default it says

User daemon
Group daemon

Change the User from daemon to your macOS Username. For me, my User group now looks like

User danielschnoll
Group daemon

Upvotes: 39

Related Questions