Question

Apache PHP Web Server- PHP5.6 and PHP 7

Posted March 26, 2017 8.2k views
CentOSApachePHP

I want to run two versions of PHP i.e 5.6 and 7.0 on the same machine. Please help me so that I can run my separate websites on separate versions.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
3 answers

@abhitestforum

This can be done on Ubuntu using a PPA which offers 5.6, 7.0, and 7.1, though I’m not seeing a repo that has all versions of PHP available for CentOS right off.

Without a repository to support multiple installations to different directories, you’d need to compile PHP manually and define the directories.

On Ubuntu 16.04/16.10, this would be as easy as:

add-apt-repository -y ppa:ondrej/php
apt-get update

You can now search available PHP packages using:

apt-cache search php5.6
apt-cache search php7.0

And then run:

apt-get -y install php5.6 .....

Where php5.6 ..... would be a list of PHP packages you wish to install.

I think that both these versions of PHP can be used simultaneously via mod_suphp apache module. I’ve successfully done this a couple years ago on CentOS 5 + PHP 5.2 with PHP 5.6.

Please can You found a solution, in my case I’d like to make both php5 and 7 run in apache2 for separate app. Any help :/

Submit an Answer