PHP TestFest VM Documentation - Installing PHP

Documentation Home

This file provides instructions for installing a version of PHP which you have built using the instructions in the building PHP section. Skip to the section pertaining to the version of PHP you wish to install.

Preparation

It's always recommended that you update the installed packages before building new software on the VM.

sudo apt-get update
sudo apt-get upgrade

Installing PHP 5.2

Change to the directory containing the PHP version you've just built.

cd ~/src/php5.2-200904151630

Run the make install

sudo make install

Setup the php.ini file.

sudo cp php.ini-dist /usr/local/lib/php.ini

If PHP 6 was install previously, you need to remove any PHP 6 module configuration files which could conflict with the new install.

sudo rm /etc/apache2/mods-enabled/php6_module.conf
sudo rm /etc/apache2/mods-enabled/php6_module.load

Create the file /etc/apache2/mods-enabled/php5_module.conf and include this in it:

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

Create the file /etc/apache2/mods-enabled/php5_module.load and include this in it:

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

Comment out the following line in /etc/apache2/httpd.conf

#LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

Change extension_dir in /usr/local/lib/php.ini

extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20060613/"

Restart Apache

sudo /etc/init.d/apache2 restart

Installing PHP 5.3

Change to the directory containing the PHP version you've just built.

cd ~/src/php5.3-200904151630

Run the make install

sudo make install

Setup the php.ini file.

sudo cp php.ini-dist /usr/local/lib/php.ini

If PHP 6 was install previously, you need to remove any PHP 6 module configuration files which could conflict with the new install.

sudo rm /etc/apache2/mods-enabled/php6_module.conf
sudo rm /etc/apache2/mods-enabled/php6_module.load

Create the file /etc/apache2/mods-enabled/php5_module.conf and include this in it:

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

Create the file /etc/apache2/mods-enabled/php5_module.load and include this in it:

LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

Comment out the following line in /etc/apache2/httpd.conf

#LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

Change extension_dir in /usr/local/lib/php.ini

extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20060613/"

Restart Apache

sudo /etc/init.d/apache2 restart

Installing PHP 6.0

Change to the directory containing the PHP version you've just built.

cd ~/src/php6.0-200904151630

Run the make install

sudo make install

Setup the php.ini file.

sudo cp php.ini-production /usr/local/lib/php.ini

If PHP 5 was install previously, you need to remove any PHP 5 module configuration files which could conflict with the new install.

sudo rm /etc/apache2/mods-enabled/php5_module.conf
sudo rm /etc/apache2/mods-enabled/php5_module.load

Setup the php.ini file.

sudo cp php.ini-production /usr/local/lib/php.ini

Create the file /etc/apache2/mods-enabled/php6_module.conf and include this in it:

<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>

Create the file /etc/apache2/mods-enabled/php6_module.load and include this in it:

LoadModule php6_module /usr/lib/apache2/modules/libphp6.so

Comment out the following line in /etc/apache2/httpd.conf

#LoadModule php6_module /usr/lib/apache2/modules/libphp6.so

Change extension_dir in /usr/local/lib/php.ini

extension_dir = "/usr/local/lib/php/extensions/no-debug-zts-20060613/"

Restart Apache

sudo /etc/init.d/apache2 restart