So, you decided to upgrade to Mac Tiger Workstation and your PHP service stopped working. No fear, as PHP will still work fine once you make a simple change to your Apache 2 configuration file. Previous versions of Mac OS 10.4 and below were using Apache 1 series, not Apache 2 series. You need only un-comment a single line in the Apache httpd.conf file. Knowing where it is and how to modify it is not something most developers bother with. Assuming you have the permissions to make the needed change, your PHP service will be up in mere moments.
NOTE: Whenever making config or ini file changes, make backups/copies as needed so you can revert back to the original settings. It definitely sucks when you blow u your system and have no way to revert.
Open your Applications folder, then the Utilities folder, and launch the Terminal application. If you know CLI, sudo into the terminal. Else, wait for the prompt for your password. We need to access the httpd.conf file inside a directory (folder) called apache2, which is hidden from most users. An easy method for accessing this folder is via the Terminal and typing the following text, followed by hitting the RETURN or ENTER key:
The result should be the appearance of this directory with the files enclosed. If necessary, enter your admin password. Look for the “httpd.conf” file, which contains a lot of text. Try not screwing up this file as it will possibly stop Apache from operating and cause you grief.
Depending on what text editor you are using, search for the following line of text around line 114 or 115:
#LoadModule php5_module libexec/apache2/libphp5.so
Simply remove the # symbol at the start of the line, which effectively un-comments it from the config file. Where the # stops lines from being processed by Apache at startup, its removal will now allow Apache to process the line and startup your PHP 5.2.4, unless you are running old versions. If you are running a release of PHP 4.x or lower, upgrade to avoid security issues and join the modern age, please.
Your text editor may be a pain when you try to modify or save the modified httpd.conf file. Some applications let you open, but not edit file that are controlled by admin permissions. If your eitor has a fit, here is another simple workaround to get the job done.
OPTION-DRAG the httpd.conf file to your Desktop. Make the above modifications and save the file back to the Desktop. OPTION-DRAG the httpd.conf file from the Desktop to the /etc/apache2 directory, and overwrite the original. This will likely prompt you for the admin password, and wil then replace the original httpd.conf file with the new PHP-Enabled version.
Now, go to your System Preferences and select the Sharing pane. Stop “Web Sharing” and then start it again. This reloads the Apache 2 configurations files and hopefully activate your PHP service. Not sure if PHP started working? Maybe you shouldn’t be reading this at the moment! PHP comes pre-installed in Tiger and should be working now. If you want more installation assistance with PHP and MySQL, refer to www.entropy.ch
Testing the PHP Service is easy. Create a file with a .php extension and write the following texxt inside the document. Then browse the document using the http protocol.
<?php phpinfo(); ?>
Save the .php file (ex. phpinfo.php) to your web server root: