Running multiple php version e.g php4 & php5 required some times for old style applications that is dependant on php4 but applications like wordpress you are required to have php5. Let see how we tackle this problem.
In my scenario, i have CentOS 5 running on my server with apache2. I will be installing php4 in CGI mode and php5 as standalone module for apache. You can use the following method for debian distro too.
Installing apache2 & php5
yum install httpd
yum install php
Now download the source code of php4, you can chose nearest php4 mirror from here.
wget http://www.php.net/get/php-4.4.9.tar.gz/from/ar.php.net/mirror
tar -zxvf php-4.4.9.tar.gz
cd php-4.4.9
Note : do not add support for apxs2, it will break up the php5 as module for apache2
./configure –prefix=/usr/local/php4
make
make install
cp -v php.ini-recommended /usr/local/php/etc/php.ini
Configuring php4 as CGI script for Apache.
ln –s /usr/local/php4/bin/php /var/www/html/cgi-bin/php
chmod 755 /var/www/html/cgi-bin/php
Configuring Apache for php4
cp –av /etc/httpd/conf.d/php.conf /etc/httpd/conf.d/php4.conf
Update these :
vi /etc/httpd/conf.d/php4.conf
Action php4-script /cgi-bin/php
AddHandler php4-script .php4
AddType text/html .php
DirectoryIndex index.php4
2 replies on “Running Apache with Multiple PHP Versions”
Not Found
The requested URL /cgi-bin/php/info.php4 was not found on this server.
Apache/2.2.15 (CentOS) Server at 192.168.100.2 Port 80
how to solve this problem
Thanks
Luqman
Not found simply means, file doesn’t exist. lol