简体   繁体   中英

Is it Possible to use more than one PHP Version in Ubuntu?

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?

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

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:

  1. Install PHP-FPM 5.x as a service, and start it up.
  2. Install PHP-FPM 7.x as a service, and start it up.
  3. If you haven't installed your webserver yet, do that too.
  4. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM