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

it seems that some of my php applications require php 5.2 and some require php 5.3. is there a way to configure apache (v2.2.14) that one virtualhost will work with one php library and a different virtualhost will require a different one?

currently the only solution that i found is to install two apaches and two phps and each of the apache will reside in a different port.

thanks

share|improve this question

migrated from superuser.com Jan 18 '10 at 15:20

This question came from our site for computer enthusiasts and power users.

1  
Poor application design if people are coding for a point release rather than a major release. Generally, point releases shouldn't have breaking changes in them. –  Chris Jan 18 '10 at 13:04
    
Have you tried running the PHP 5.2 app on PHP 5.3? –  ceejayoz Jan 18 '10 at 15:31
1  
While point release SHOULDN'T have breaking changes the reality is that PHP 5.3 does indeed break code that runs perfectly on 5.2. –  John Gardeniers Jan 18 '10 at 21:51
1  
Some versions of Drupal 5.x won't run properly on PHP 5.3... Thanks... –  tegbains Jan 18 '10 at 22:00
add comment

3 Answers

up vote 1 down vote accepted

If you would use PHP 4 and 5 it would be easy to manipulate what module you want to use with:

<IfModule mod_php5.c> 
<IfModule mod_php4.c> 

So there 3 ways to deal with this problem:

  1. Correct the problems in the PHP scripts (imho the best way)
  2. Modify the PHP source code so it reports itself as "mod_php52.c","mod_php53.c"
  3. Run it as CGI where needed Check it out here

You can also run 2 servers on different ports and use a proxy

share|improve this answer
add comment

Yes it is possible. You should use fastcgi mode by "FcgidWrapper" directive in apache configuration. This way you can define different fastcgi handler daemons for different url extension, path, or even virtual hosts. In the background, each fastcgi daemon then can easily executes different php versions.

share|improve this answer
add comment

I use PHPfarm to run many PHP versions on one apache instance. Works absolutely fine.

You basically install alternative PHP versions as CGI and use them to handle .php files in certain vhosts.

share|improve this answer
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.