For a long time I wanted to be able to run both PHP 4 and PHP 5 on the same server. Now I finally managed to come up with a solution that is easy to install and easy to use.
- Add the Debian Backports repository to your /etc/apt/sources.list
deb http://www.backports.org/debian/ sarge-backports main contrib non-free
- Issue a package update: aptitude update
- Install PHP 5 as CGI module: aptitude install php5-cgi
- Configure Apache by adding the following lines to your main config file. In my case this was /etc/apache2/apache2.conf
ScriptAlias /php5-cgi /usr/lib/cgi-bin/php5 Action php5-cgi /php5-cgi
- Now find the Virtual Host you want to run on PHP 5 and simply put the following line into the <Directory> directive.
AddHandler php5-cgi .php
This overrides the default handler for files ending in .php which would be the normal PHP 4 module. Whit this directive it is now parsed and executed by the PHP 5 CGI binary.
- Reload your webserver config with