« Home | Reinstalling OS X from Scratch » | Vonage Increases Prices » | BlackBerry Curve (8820) Fails During OS Upgrade » | How to Transfer blogs between Blogger Accounts » | Turning Your Laptop into a Universal Charger » | Happy Thanksgiving » | Leaving Credit Cards Behind » | Beware: Gift Cards for Closing Stores » | Personnel Concepts Compliance Letter Revisited » | Windows XP Display Rotated 90 Degrees »

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: ,