Running PHP4 and PHP5 concurrently.
Running PHP4 and PHP5
There are many times when we need PHP4 and PHP5 to run concurrently on the server.In such cases we can Install one as apache module and other as CGI
Install PHP4 or PHP5 as apache module. Lets install PHP5 as apache module
Download PHP5 untar it and move to its directory.
If file /usr/local/apache/modules/libphp5.so does not exist or is an older version, type this from PHP source code directory.
4 cp -p .libs/libphp5.so /usr/local/apache/modules
5 copy php.ini-recommended from PHP source code directory to installation directory.
6 Add following to http.conf
LoadModule php5_module modules/libphp5.so
AddHandler php5-script php
DirectoryIndex index.html index.php
AddType text/html php
Now install PHP4 as CGI
Download PHP4 untar it and move to its directory.
1 ./configure --prefix=/home/somedir/php4 --enable-force-cgi-redirect --program-suffix=4
–enable-force-cgi-redirect- Enable the security check for internal server redirects. Not enabling option disables the check and enables bypassing httpd security and authentication settings.
–program-suffix -adds the given suffix.
3 make install
4 Add following to http.conf
ScriptAlias /cgi-sys/ /usr/local/cgi-sys/
Action application/x-httpd-php5 "/cgi-sys/php-cgi5"
AddHandler application/x-httpd-php5 .php5
Restart Apache. And now you use PHP4 and PHP5 concurrently !