Setting up apache on osx lion
First of all I uncommented a couple of lines from /etc/apache2/httpd.conf.
To enable PHP5:-
LoadModule php5_module libexec/apache2/libphp5.so
To enable the use of virtualhosts:-
I can then create virtualhosts in /private/etc/apache2/extra/httpd-vhosts.conf like so:-
Then to serve a local site from http://sandbox.macbook.local add a line to /etc/hosts:-
One issue that took me a while to figure out was that I was getting a 403 error when I tried to use AllowOverride All, which lets me use .htaccess
I found the answer here. Basically, the options line needs to be set to "Options All":-
Allow from all
(The above rules are added to a file /private/etc/apache2/users/yourusername.conf). Remember to restart apache after making these changes!