A quick fix for the dreaded Apache 403 Forbidden Error on OSX Lion

After deciding to ditch MAMP and start taking advantage of Lion's preinstalled Apache2 and PHP, I ran into the infamous 403 Forbidden situation. I tried several solutions, to no avail.

Then it occurred to me… if MAMP was working, maybe there was something in its configuration that I needed. So I set about looking through MAMP's httpd.conf and found this:

<IfModule !mpm_winnt.c>
<IfModule !mpm_netware.c>
#
# 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.
# ??. On SCO (ODT 3) use "User nouser" and "Group nogroup".
# ??. On HPUX you may not be able to use shared memory as nobody, and the
# ?? ??suggested workaround is to create a user www and use that user.
# ??NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
# ??when the value of (unsigned)Group is above 60000;??
# ??don't use Group #-1 on these systems!
#
User myusername
Group #-1
</IfModule>
</IfModule>

Copy+paste that into /etc/apache2/httpd.conf and voil??!??Permission problems solved.

Advertisements