How to run multiple versions of PHP?

How to run multiple versions of PHP on ubuntu 14.04 in the same computer?

If you want to use multiple versions of PHP at the same time, you can, however you won’t be able to use mod_php for them, you will have to use seperate methods to load and use the different PHP versions for different sites (php-fpm for example). If you don’t mind switching versions, Lorna Jane has a good article for Ubuntu

1 Like

Hello Timlgoe,

thanks for sharing link but i already have this link but i am not too much familiar with Ubuntu ,can you please guide me how can i do that ?

I think it’s only possible on Windows. But there’s really no reason to run multiple PHP versions unless you are intending to use multiple versions for backwards compatibility. Otherwise, there really is no use to have more than one PHP running at once.

1 Like

@spaceshiptrooper i know but i want to do this in ubuntu if you have any idea then let me know
and thanks for your message

I haven’t tried this myself, but I’ve read the link @TimIgoe provided, and it seems to give quite clear instructions. Where are you running into problems with it?

There are several ways to run multiple versions of PHP on any platform - however, I’ve given you a simple guide there to use on Windows that should get you to do what you want to do without the compleixity of some of the other solutions.

1 Like

Oh, I see what the article is doing. Yes. It’s possible to install different versions like that on Ubuntu. But it’s super easy to switch between different versions on Windows. Especially because the ones for Windows isn’t strictly just PHP 5.6 and PHP 7.0. You could have PHP 5.4, PHP 5.5, PHP 5.6, PHP 7.0 RC1, PHP 7.0 RC2, .etc and have it all run under the same Apache configuration. I mean the only reason why I like the one on Windows more is because I can actually switch between different versions without a problem. That can’t be said about Linux because there’s only 2 specific versions that are released on Linux. There’s PHP 5.6 and PHP 7.0 or I believe there’s also PHP 7.1, but that’s about it. And the thing that sucks about using the ones on Linux is that basically, those versions may be different in comparison to the ones you are using on a live server. Live servers may have PHP 5.6.3 and the one from Linux may only be PHP 5.6.2 or even PHP 5.6.4. This is important in a way because with different mini versions, there are different adjustments.

Example. PHP 7.0 RC1 - PHP 7.0 RC5 all are ok with mcrypt. However in PHP 7.0 RC6, mcrypt is deprecated. So minor changes can make a big difference. I mean speaking on terms about different changes is pretty critical. That’s the only reason why I like the one on Windows more. You can switch between varies versions without sticking to the specific one that they give you. Where as for Linux, you are stuck with the specific ones they give you.

I guess anyone can argue about this and that their preference is on this machine and what they believe is best on what machine. But long story short. Windows has more varieties of versions to choose. So you can even go with the latest version which is 7.1.6 which probably, Linux doesn’t have. I mean I develop in Linux too. But very small times, I’ll develop in Windows.

You can eaily get all the versions on Linux, just like Windows.

One of my Centos servers has 5.3.3 (base), 5.4.6 (SCL), 7.0 (IUS) and 7.1 (IUS) all installed for various projects.Its about how you switch between them.


This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.