Question

Apache PHP Web Server- PHP5.6 and PHP 7

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.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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 :/

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.

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