Reputation: 513
I am trying to run a php app but keep getting the
"Forbidden You don't have permission to access /folder on this server."
I have Require all granted
uncommented in my httpd.conf and I've also tried setting the permissions with
sudo chown -R $USER:$STAFF ~/Sites/secondPHPApp
and
sudo chmod -R 755 ~/Sites/
I have my phpadmin in that file. I can access the phpadmin from the browser and get the IT WORKS default page but having trouble accessing my app folder because of the permission issue.
This is my vhost settings in httpd-vhosts.conf (note: I do have an actual email and username in the actual file.):
<VirtualHost *:80>
ServerName test.com
ServerAlias www.test.com
ServerAdmin email
DocumentRoot “/Users/username/Sites/secondPHPApp”
</VirtualHost>
<VirtualHost *:80>
ServerName localhost
DocumentRoot /Library/WebServer/Documents/
</VirtualHost>
Result of ls -al ~/Sites
:
total 32
drwxr-xr-x 6 755 staff 204 Feb 16 11:00 .
drwxr-xr-x+ 51 LonnieMcGill staff 1734 Feb 15 14:33 ..
-rwxr-xr-x@ 1 755 staff 6148 Feb 16 10:47 .DS_Store
-rwxr-xr-x 1 755 staff 20 Feb 15 09:53 index.php
drwxr-xr-x@ 112 755 staff 3808 Feb 15 13:34 phpmyadmin
lrwxr-xr-x 1 755 staff 60 Feb 16 11:00 secondPHPApp -> /Users/LonnieMcGill/Desktop/Project Folder/php/secondPHPApp/
Result of ls -al ~/Sites/secondPHPApp
:
lrwxr-xr-x 1 755 staff 60 Feb 16 11:00 /Users/LonnieMcGill/Sites/secondPHPApp -> /Users/LonnieMcGill/Desktop/Project Folder/php/secondPHPApp/
Result of ls -al ~/Sites/secondPHPApp/index.html
:
-rw-r--r-- 1 LonnieMcGill staff 360 Feb 16 11:02 /Users/LonnieMcGill/Sites/secondPHPApp/index.html
Upvotes: 1
Views: 2477
Reputation: 14921
After investigating with Lonnie in the discussion for a while, it turns out that it was the french double quote. Since the french double quote and the english double quote is different, apache consider it part of the file path therefore its unable to locate the document root specified in the vhost so it returns a 403 error.
DocumentRoot "/Users/username/Sites/secondPHPApp"
Upvotes: 1