Technix
Technology Weblog

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.

  1.  ./configure --with-apxs=/usr/local/apache/bin/apxs
  2.  make
  3.  make install

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.

2 make
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 !

About these ads

One Response to “Running PHP4 and PHP5 concurrently.”

  1. Its a big hassle if you have ever had to do it.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: