[ HOME | REFERENCE | FreeBSD | MySQL | PostgreSQL | Apache | qmail | PHP | Pure-FTPd ]


This is going to be really quick and easy to install PHP5. Following the installation, there will be steps on configuration, starting Apache, and starting qmail.

These NOTES were done with PHP 5.2.6.


  1. ports
  2. configure
  3. start
  4. references


i. ports

Install from ports.

# (cd /usr/ports/lang/php5 && make install clean)
# (cd /usr/ports/devel/pear && make install clean)


# (cd /usr/ports/lang/php5-extensions && make install clean)

When the configuration options screen pops up for php5-extensions, choose the following:

Some options you might need, others you might not. For example, you might be running PostgreSQL only and not MySQL. There's no reason for you to keep the MySQL option checked. The options chosen are specific to the needs of Yours will differ.

OK your options and relax. It takes awhile to configure PHP with all these options.

ii. configure

Copy the distribution php.ini configuration file.

# cp /usr/local/etc/php.ini-recommended /usr/local/etc/php.ini
# chmod 644 /usr/local/etc/php.ini

Add an include path to /usr/local/etc/php.ini

# ee /usr/local/etc/php.ini

Around line 526 or so, add the following line

include_path = ".:/usr/local/share/pear"

For PHP, that's about it, really. Be sure to read through the php.ini file and configure it to your needs.

You do need to modify Apache's httpd.conf.

# ee /etc/httpd.conf

At around line 359 or so, add these lines

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

At around line 215, you will see DirectoryIndex, modify the block to look like the following

<IfModule dir_module>
DirectoryIndex index.php index.htm index.html

Just be sure to add index.php before index.html so that Apache will default index.php before index.html in a directory.

Close and save it.

iii. start

First, start Apache

# /usr/local/etc/rc.d/ start

Test for PHP by displaying phpinfo().

# ee /usr/data/www/

Insert only one line in this index.php

<?php phpinfo(); ?>

Close and save it.

Visit to see if you get the php information page.

Last but not least, start qmail.

# /usr/local/etc/rc.d/ start

Again, best of luck!

iv. references


$NOTES: /php/, v.0.22 2010/12/11 13:44:35 PST /6571/ NkM$
Maintainer: Neafevoc K. Marindale