The Apache/PHP Stack is a pre-configured environment for deploying PHP based web application within the Postgres Plus environment. Learn how to quickly install the Postgres Plus Apache/PHP stack in a Mac OS X environment.
Installing Apache and PHP is a very simple process thanks to Apple who has chosen to include both the Apache Web Server and PHP in the latest versions of OS X.
In this tutorial, we will walk you through the process of ensuring that both the Apache Web Sever and PHP development environment are set up to run on your local machine.
The first step is to enable Apache on OS X. Even though Apple has included it in the installation of OS X on your machine, you must still enable the server to operate.
To start the Apache Web Server, you must first open up the "System Preferences" control panel located on the "Apple Menu" or thru the "System Preferences" icon on your shelf.
Click on the icon labeled "Sharing" in the Systems Preferences window.
Then select the checkbox for "Web Sharing". By selecting the "Web Sharing" checkbox you enable the Apache Web Server to run. Unchecking this checkbox will turn off the Apache Web Server.
In order to confirm that your Apache Web Server is enabled and running, simply click on either link for "Your computer's website" or "Your personal website".
If Apache is running, your browser will display the following:
This page will confirm that the installation of the Apache Web server software on this system was successful. You may now add content to this directory and replace this page.
Your website will now be located under the users/Sites directory on your Mac.
Our next step is to ensure PHP is enabled and working on OS X. In this case we will be addressing OS X Tiger.
Our first step is to have you make some very simple changes to the httpd.conf file located in the /usr/httpd/ directory. For the purposes of this tutorial, we will not provide instructions on how to use terminal or any editors.
Let's find and edit the httpd.conf file which should be located in the /usr/httpd directory. In order to edit this file you must use sudo as you will need root privileges to edit this file.
This should be the command if you are using the VI editor.
sudo vi /etc/httpd/httpd.conf
As our next steps you will need to uncomment two lines which are currently commented out.
#LoadModule php4_module libexec/httpd/libphp4.so
Uncomment these lines.
You can now must restart the Apache Server by going back to System Preferences, Sharing and Services and stop and start the Personal Web Sharing.
Verifying that PHP is enabled by creating a simple PHP file as shown below. Access the file from your site directory where your webserver finds the index.html file. This should provide status information on php information.