As you might know, you can start the Apache server by switching to the sharing preferences and activating the option "Personal Web Sharing". If you now launch Safari and connect to "http://localhost" you should get Apaches's welcome page telling you that the server has been started successfully. By the way the content of your "sites" folder, located in your user home, can be accessed by appending "yourUsername" to the URL.
In order to determine whether the PHP module is already enabled or not, navigate to the "sites" folder and create a new PHP file called "phpinfo.php". Open the file and insert the following piece of code:
| <?php phpinfo() ?> |
Now if you open the file in your browser, you might notice that the php command is not interpreted by the server. This is because the PHP module is not enabled by default.
PHP4
In order to enable the preinstalled PHP4 module you have to open Apache's configuration file, located under /etc/http/http.conf. Open the file in your favorite editor and uncomment the lines containing "LoadModule php4module" and "AddModule modphp4.c". Save the file and restart your Apache.
If you now reload your phpinfo file you should get a detailed list, contaning information on the configuration of your PHP module. If you don't want to make use of PHP5's object oriented functionalities you can stop reading here and enjoy your new PHP enabled Apache server.
PHP5
But if you are like me and enjoy the new OOP functionality, navigate to Marc Liyanage's Website and download the PHP5 package for Apache 1.3. The size of the package is about 27MB - so it might take a while before the download is finished. Now mount the disk image and run the installer. Afterwards restart your server and once again display the phpinfo file - you will notice that the version 5.04 of PHP has been installed successfully. Enjoy.












