Welcome to WebmasterWorld Guest from 184.72.177.182

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Can I run multiple versions of PHP on Apache?

     
3:56 am on Jul 5, 2013 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
posts:14487
votes: 49


I have not done much research into this yet, but hope someone here might be able to provide some advice.

I have a production FreeBSD server running Apache and it is running PHP 5.2.17 as an Apache module. The company that developed a CMS for me on this server cannot guarantee that it will work on newer versions of PHP.

I need to run a few other CMS packages for upcoming websites. However, these packages are suggesting PHP 5.3.x or 5.4.x as a minimum requirement.

Is there a way I can run more than one version of PHP at the same time on Apache?
5:09 am on July 14, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


you can probably run one version as mod_php and the other as FastCGI.
2:11 am on July 18, 2013 (gmt 0)

Administrator from JP 

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Oct 12, 2000
posts: 14487
votes: 49


The more I look into this the more I think I had better just make a VM to develop on other versions of PHP. I don't want to get too far into uncharted waters with my production machine.
6:28 am on July 18, 2013 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:10544
votes: 8


you could probably bend your server into a pretzel and run up to 4 versions of PHP simultaneously.
Serving PHP with Apache: AddType and AddHandler:
http://www.webmasterworld.com/apache/4557229.htm [webmasterworld.com]

(just because you can doesn't mean you should)
=8)
9:00 am on July 18, 2013 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month

joined:Apr 9, 2011
posts:12720
votes: 244


The company that developed a CMS for me on this server cannot guarantee that it will work on newer versions of PHP.

Can you pin them down to any details? php is not the most backward-compatible language in the world, so at bottom we're talking about specific commands or functions that may no longer work. This is already a warning sign, because generally when something is deprecated-- in any environment-- it's because there is something wrong with it. Or, at least, that the alternatives are so much better that they're trying to sweep the old version under the rug.

See if you can back your developers into a corner and find out (a) what, exactly, might no longer work as intended and (b) why it can't be changed to something that does still work.
2:11 am on July 22, 2013 (gmt 0)

Senior Member

WebmasterWorld Senior Member Top Contributors Of The Month

joined:July 19, 2013
posts:1097
votes: 0


It is possible, because I've had hosts with both php4 and php5 running before.

I haven't looked into the entire process, but I've installed PHP on a server before and you should be able to install two version as long as you set the location of the installations to different locations (they should be different anyway afaik), set the locations of the ini files to different places and then use different extensions on URLs combined with <FilesMatch "\.your_php4_ext"> -> AddHandler/AddType for php4 + <FilesMatch "\.your_php5_ext"> -> AddHandler/AddType for php5 in the httpd.conf or something along those lines...

Been a while since I've set up a server, so I don't remember off the top of my head all the necessary settings you'll have to change to keep the two separate when you do the installation, but I'm sure it can be done.