I want to configure more than one PHP in my local so it is possible to use more than one PHP version in single operating system. Like PHP 5.6 and PHP 7.2?
Asked
Active
Viewed 173 times
1
-
2Yes, that's possible – brombeer Oct 31 '18 at 10:42
-
1Welcome, what is your Ubuntu version? – GAD3R Oct 31 '18 at 11:00
-
2Possible duplicate of [Multiple PHP versions on the same box](https://stackoverflow.com/questions/1905548/multiple-php-versions-on-the-same-box) – Fine Oct 31 '18 at 11:00
-
1I got answer thank you all – Jaimin Oct 31 '18 at 11:00
2 Answers
5
Yes, you can. Please try to install like
$ sudo apt install php5.6
$ sudo apt install php7.0
Here php5.6 and php7.0 is PHP version

Divyarajsinh
- 188
- 3
- 9
1
You can easily install both side by side, but I think your real question might be: "Can you run PHP 5 and PHP 7 simultaneously in a web-server on Ubuntu?".
Yes, that is possible! But no, it would take way too long to explain in a single answer here. It also depends on whether you use Nginx or Apache as your chosen webserver.
The short summary is:
- Install PHP-FPM 5.x as a service, and start it up.
- Install PHP-FPM 7.x as a service, and start it up.
- If you haven't installed your webserver yet, do that too.
- Configure your webserver so that when a PHP script is called, the call is passed to whichever PHP version you want.
Yes! This will require a bit of research on your part into PHP-FPM and webserver configuration. Googling for "ubuntu php-fpm simultaneously" should turn up plenty of links to get you started.

Ben Hillier
- 2,126
- 1
- 10
- 15