PDA

View Full Version : Getting different php versions to coexist



MarkRS
28th February 2010, 02:38 PM
php 5.3.1 causes trouble with quite a bit of web software.

This is a nuisance since it is issued as standard with F12.

Is there really no reasonably easy way to have the two co-exist?
I understand I'd probably need to restart Apache when I want to switch but that is at least better than the only advice I've been able to find on the Fedora forums of "remove 5.3.1 first".

I'd really like to know how to have the two and just switch between them on my desktop setup (which I use to test s/w before going live, which also seems to me a reasonable thing to want to do.

TIA
Mark

pete_1967
28th February 2010, 03:11 PM
You need to compile (at least) the additional versions from source to their individual locations to keep them separate. Then you need to either use virtual hosts to run specific version or use htaccess (with httpd.conf) to load specific php version.

Another option is to run php as CGI (you still need to compile each version).

Once all is done, you don't need to restart Apache to switch between php versions to use with specific app you are running on your server (of course, that's after you've done the configuration).

AlexDudko
28th February 2010, 03:42 PM
The standard was php-5.3.0, which then was updated to the latest 5.3 branch's version.
There's no need to remove php-5.3.x you can compile any version you need. One more variant will be compiling both apache and php to some deliberately created for this purpose directories (http and php for instance), then you can start either apache with F12 default installed php-5.3.x running standard service httpd start, or starting the compiled apache running /http/bin/apachectl start to have another version of php.
In any case SELinux extra configuration will be needed if it is not in disabled or permissive mode.

MarkRS
3rd March 2010, 08:06 PM
Since php is loaded as a module by Apache, could I load a, or indeed as many, php versions as I wanted, each in their own subdirectories?

I s'pose I was just looking at .so files to start with, but presumably the actual php installation needs to be "switchable" too.

It would of course mean I was switching the whole machine, but I'm looking for a simple solution with a bit of flexibility. Not having played very much in Linux I'm not sure how to build an Apache and/or setup :(

Mark

pete_1967
4th March 2010, 12:12 AM
Not having played very much in Linux I'm not sure how to build an Apache and/or setup :(

You DON'T need more than one Apache version to run multiple PHP versions to start with.

And what comes to "how to compile", that's what the manuals are for, read one (like PHP's) and learn from it.