5 Minute Guide to Enabling PHP and Apache under OS X Leopard (10.6)
Apache and PHP are pre-installed by default. You simply have to enable them. Turn on web sharing and browse to 127.0.0.1. You should see the Apache test script.
Next, edit the apache configuration script to remote the pound sign (#) from the beginning of the line that says, "LoadModule php5_module..." I use the vim editor, but for those who are command-line challenged, here is a tutorial that uses the graphical editor.
$ sudo vi /etc/apache2/httpd.conf
and edit the php load script line to say:
LoadModule php5_module libexec/apache2/libphp5.so
Save the file, and restart the webserver:
$ sudo apachectl restart
Next create a test.php file in /Library/WebServer/Documents with the following contents:
<?php phpinfo(); ?>
Browse to http://127.0.0.1/test.php. You should see the phpinfo output.
Done!
Labels: Mac OS X, Web development