Last updated by owen barton on Mon, 2007-11-05 17:27
You really only need to do this if you need to test and support existing modules on php 4. Generally it is acceptable for new modules to release them php 5 only. Drupal 7 will be php 5 only. Unless you know for sure that you need this it is recommended to use the standard mod-php5 configuration instead.
Since Ubuntu 7.04 php4 packages have not been provided or supported by Ubuntu, so (unless you are running an older 6.xx version of Ubuntu) you will need to find/add repositories that provide php4 packages.
http://tumbleweed.org.za/2007/06/10/php4-for-feisty-pbuilder-for-beginners/ provides a repository for 7.04, and also instructions on building php4 from source which should work for 7.10.
To set this up you will need to install both the php5-cgi and php4-cgi packages, and uninstall the libapache2-mod-php5 package (if you have it installed already). You can do this using Synaptic (System -> Administration -> Synaptic Package Manager) or the following commands:
sudo apt-get remove libapache2-mod-php5
sudo apt-get install php5-cgi php4-cgiYou can then add the following code to /etc/apache2/httpd.conf
ScriptAlias /php5-cgi /usr/lib/cgi-bin/php5
ScriptAlias /php4-cgi /usr/lib/cgi-bin/php4
AddHandler application/x-httpd-php .php
Action application/x-httpd-php /php5-cgiYour vhosts will then use php5 by default. If you have a vhost you want to use php4, you can easily do this by adding the following line to the top of your Drupal .htaccess file:
Action application/x-httpd-php /php4-cgiApache will then use php4 for serving this site (there is no need to restart Apache, this takes effect immediately).