PHP MacPorts Tutorial
PHP version 5 has some significant improvements over the PHP version 4.1.14 that shipped standard with Mac OS X 10.4.To configure php, you need to edit the httpd.conf file of Apache, using your preferred command line editor. In this example, we will use pico:
cd /opt/local/apache2/conf
sudo pico httpd.conf
Then in the editor scroll down (control-v) to the list of LoadModule statements. At the end of this list, add the following:
LoadModule php5_module modules/libphp5.so
Then scroll down further to the
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
AddType application/x-httpd-php-source .phps
You will also want to make sure your DirectoryIndex directive looks something like this:
<IfModule dir_module>
DirectoryIndex index.php index.html
</IfModule>
DirectoryIndex index.php index.html
</IfModule>
You should now save (Control-O) and exit (Control-X) your command line (Pico) editor. You can now restart Apache, and test php using a phpinfo(); file.


