
Mac OS X (currently Leopard 10.5.3) includes an implementation of the Apache HTTP server. However, it isn’t running by default nor does it have the PHP engine enabled. This guide shows you how to activate Apache with PHP support in a few easy steps.
Enable the Apache PHP Module
Enabling PHP on the version of Apache that is distributed with OS X requires a minor change to the Apache configuration file. If you are not currently logged in as an administrator with sudo privileges open a terminal and do so now (substitute your administrator username for admin below).
Edit the Apache http.conf file using your favorite text editor. I use vim below.
Scroll down the configuration file until you find a commented line (comments are indicated by the # symbol) that begins as follows:
Uncomment this line, save, and exit the editor.
Turn on the Apache HTTP Server and Test a PHP Page
To turn on Apache, navigate to System Preferences>Sharing. In the “Service” list check the box next to “Web Sharing” to turn Apache on. To test that Apache is running, open a web browser and type in the following URL substituting your username for yourname.
A default Apache webpage should load. All of the files associated with your website are by default stored in the Sites directory in your home folder. Now create a PHP file in this directory in order to test that the PHP engine is working. Open a terminal and type the following:
If PHP is working correctly, information about your installation of PHP should be displayed when the following URL is typed into you browser.
That’s it. If you would like to now install MySQL on your Mac, I would encourage you to take a look at this post which also describes how to install a database for use with WordPress.

Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks