How to install php 5.4 alongside php 5.2 on centos 5 and virtualmin

Does anyone know how to install php 5.4 alongside php 5.2 on centos 5 and virtualmin?

I saw the following link, but the problem is this is only for CentOS 6:

Is there any way to install php 5.4 on Centos 5?


just to be clear, this server has some older software on it and unfortunately needs to have php 5.2 installed


You can try this: but you should start thinking how to switch to something else. Old software is usually not updated and many times is result of abandoned project what open the door to all sort of hacking and abuse.

correct me if I’m wrong, but won’t that replace php 5.2 with php 5.4?

I need to keep both

Please read that article again because everything is explained and easy to understand. You can have both or you can replace its up to you and what you need/want.

I do apologize, I have read the article from top to bottom and see no mentioning of running multiple versions of PHP, only upgrading, is there perhaps something I am missing?

And thanks in advance - I appreciate your help.

If you want to keep both versions of php just dont execute “yum install yum-plugin-replace” and “yum replace php-common --replace-with=php54w-common”. But like i said you should really upgrade your OS and replace outdated software which i find bigger problem than your OS (for now). There is no valid reason why any application would ask you to stay on Centos 5 if is not outdated for several years.


The easiest way to do what you’re describing is with CentOS 6 – I don’t believe the SCL repository described in the link I mentioned in the first comment offers packages for CentOS 5.

The SCL repository is provided by CentOS, so it’s well supported.

There are third party repositories that will enable you to do that, though we haven’t done any testing with those at Virtualmin.

If you’re looking to use a third party repository on your live server, I might suggest testing it out on a test server rather than making changes on your live server, just to make sure it all works as expected.


@Eric: I tested the link what i gave to OP on Centos 6 and didnt find any problem but i keep both versions of php (5.3 and 5.4) and because i put php 5.3 as default no problem with mcrypt. I would never link something if i didnt test before on my server.

Sorry, I’m not trying to imply it doesn’t work for you! I’m just saying that there’s only one repository that we formally test and recommend for Virtualmin.

Others can definitely work though!


I don’t know if phpFarm would be a solution for your needs.