php5 and php4 on same server as CGI
Sometimes we may have to run php4 and php5 on the same server. There is procedure to do this in cPanel server, otherwise you may end up in messing up whole server.
tar -zxf php-5.2.11.tar.gz
./configure --prefix=/usr/local/php5 –add_the_remaining_options_from_php4_expect_apxs
Now, check if binary is installed:
It should show as cgi.
Now add the following lines on top of the httpd.conf file
ScriptAlias /php5/ /usr/local/php5/bin/
Action application/x-httpd-php5 /php5/php-cgi
Allow from all
Save httpd.conf file and restart apache.
Open a .htaccess file inside the folder where you need php5 and add the following code to it. Make sure .htaccess support is enabled in your apache configuration.
AddHandler application/x-httpd-php5 .php
Make a phpinfo.php file in this directory and see what is shows when taken in browser. It should be php5.
See what it shows when the .htaccess line is commented. It should be php4 then.