Apache PHP Web Server- PHP5.6 and PHP 7

March 26, 2017 733 views
Apache PHP CentOS

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.

2 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.

Have another answer? Share your knowledge.