Installing PHP
PHP stands for Pre-Hypertext-Processor. It is a fantastic application that makes the web a much better place (albiet at a price). We are installing it here because we will need it for the other articles and because you should have it in any regard!
Installing PHP5
The documentation is short, but it takes a little while to compile. It is generally ok to accept the defaults on the pop-up screens, but keep an eye out for the mysql option. It should detect it and install by default, but you never know. We need the mysql stuff internal to php! We will verify that later in case you missed it when it asked during the installation.
Do not attempt to install PHP53 as there are compatibility problems with a lot of the applications you may wish to use. Stick with PHP52!
# cd /usr/ports/lang/php52
# make install clean
# cd /usr/ports/lang/php52-extensions
# make install clean
# cp -p /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini
make sure to include the mysql and mysqli extensions
You might have already performed the following steps during the Apache Basic Installation step, but it doesn't hurt to revisit them here.
edit the /usr/local/etc/apache22/httpd.conf file. Search for "DirectoryIndex" and add index.php to the end of the line. It should read...
DirectoryIndex index.html index.php
Search for AddType application and add these lines.
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
Restart apache
# apachectl -k restart