views:

213

answers:

3

Is it possible to have multiple versions of PHP running on the same box ( like rails ) . Here is my problem , I need to start development on a new project and was planning to use PHP 5.3 for it so that I can use the latest Zend framework and active record with it .
However the machine where I need to host my application has PHP 4.4 and there are several other applications hosted there . I do not want to upgrade the PHP version on the server as in the past I have faced a lot of issues while upgrading the PHP version and deprecated functions .
I was wondering if it is possible to have multiple version of PHP on the same box and then somehow specify the version that you want your application to load ( similar to rails )

+2  A: 

Yes, it is possible. In fact, many servers operate this way. You may see .php4 and .php5 extensions from time to time indicating which version that particular script should be handled with.

ServerFault addressed this question: http://serverfault.com/questions/85385/running-php4-and-php5-along-side-each-other

Jonathan Sampson
Thanks a ton .. that helped !
NM
A: 

A possiblity is using one version of PHP as an Apache module, and the other version as a CGI ; but an idea I kind of like better is to have :

  • Several distinct instances of Apache,
  • Each one listening on a different port (for instance, PHP 4.4 on port 44000, and PHP 5.3.1 on port 53100)
  • And each one using a different version of PHP

This way, you have totally different environments, that works independantly of each other, and you can configure/modify anything you want in each environment without risking breaking any of the others.

(And if you don't want to have port numbers in your URLs, I suppose you can put a proxy in front of your distinct Apache instances, so it seems there is only one)

Pascal MARTIN
A: 

I wrote a short how-to for Windows years ago. Should work on all platforms, more or less.

djn