Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Is it possible to install 2 php versions on same server.

I have some old sites on my local system which supports php5.

But latest CMS and framework supports php5.3 . I don't want to change my old sites. But want all work perfectly.

So is it possible that I can install both versions or any other way to make workable all?

share|improve this question

migrated from stackoverflow.com Mar 13 '12 at 17:57

This question came from our site for professional and enthusiast programmers.

3  
This is more of a serverfault question. –  Crontab Mar 13 '12 at 16:41
2  
Yes, it is possible, see here: stackoverflow.com/questions/524508/… –  Charas Override Mar 13 '12 at 16:42

2 Answers 2

First

You can use something like fastCGI or patch php-fpm for versions up to 5.2.x

For versions PHP 5.3.x < 5.3.3 you can get php-fpm from the php svn like this;

cd php-5.3.x (download and unzip php first)
svn co http://svn.php.net/repository/php/php-src/trunk/sapi/fpm sapi/fpm
./buildconf --force
./configure --enable-fpm ...your other configure options, etc...
make && make install
  • After that you need to adjust the default config file (installed into $prefix/etc) and run "php-fpm".

(Instructions from http://php-fpm.org/download/)

For php 5.3.3 and later php-fpm is included in the core. So the only thing you need to do is compile php with --enable-fpm, se more here.

Second

Set up the different versions you need in different paths, and start them.

Third

Then you can point your webserver to use different running php-processes depending on which php version you need.

share|improve this answer

It heavily depends on your web server. Apache for example has the concept of "handlers" which can be simply set to different values for your PHP files in the virtual directory configuration or within a .htaccess file like this:

 AddHandler php53-cgi .php

This way, you could set PHP versions per directory easily after you've defined the appropriate Action directives for different PHP versions.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.