Search code examples
phpmacosapachepermissionshttp-status-code-403

Solving 403 permission denied error on Apache even after Allow From All and Chmod 777?


My DocumentRoot is in ~/Dropbox/Websites. It's set up as Allow From All and AllowOverride All in the vhosts and in httpd.conf, and I've even put 777 permissions on the entire DocumentRoot recursively (it's just a local dev env., I'd never do it live, don't worry). This works like a charm on Ubuntu and Windows, but on OSX it keeps telling me Permission Denied. What else can I try? Is there a way to see WHY a permission was denied? It would be nice if I at least got a hint like "_www is not allowed access to this folder" or ".htaccess does not allow entry into this folder", but this generic message is of zero help.

I have also tried changing the owner of the directory to _www:_www which is what Apache runs as on OSX, to no avail, nothing has changed.

Error log entry:

[Fri Feb 01 12:31:42 2013] [error] [client 127.0.0.1] (13)Permission denied: access to / denied

Access log entry:

127.0.0.1 - - [01/Feb/2013:12:31:42 +0100] "GET / HTTP/1.1" 403 202 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17"
127.0.0.1 - - [01/Feb/2013:12:31:42 +0100] "GET /favicon.ico HTTP/1.1" 403 213 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.57 Safari/537.17"

More info: The virtual hosts work. The access errors get logged in their proper location, under /logs inside the vhost folder itself, I just can't get past the 403 error. I assume this means it's a .htaccess problem of some kind, since apache obviously succeeds in writing to the folder, no?


Solution

  • IIRC, on OS X your home directory is not executable by world by default, so it can't get to any directory under that either. You can check with ls -ld ~, and fix it with chmod go+x ~. Make sure that every directory above your document root is at least world executable.