Enabling apache and PHP in OSX (Snow Leopard)
OS X Snow Leopard (10.6.x) comes with local apache server with lots of extensions/modules. You just need to configure (very easy) them in order to use it.
If apache is already configured (it should be), you can run it by:
sudo apachectl start
To check, if it is running, do this:
ps -aux|grep httpd
Then the typical output would be:
bgates 50737 0.0 0.0 2426844 328 s003 R+ 9:52AM 0:00.00 grep httpd
_www 50702 0.0 0.0 2451752 656 ?? S 9:43AM 0:00.00 /usr/sbin/httpd -D FOREGROUND
root 50701 0.0 0.2 2451752 9768 ?? Ss 9:43AM 0:00.51 /usr/sbin/httpd -D FOREGROUND
To enable php, you have to modify some configuration files:
find /etc/apache2/http.conf and uncomment it (remove the “#”)
#LoadModule php5_module libexec/apache2/libphp5.so
Then start/restart the apache instance by:
sudo apachectl start
or
sudo apachectl restart