Focus on cloud service provider activities
Notes on website operation and maintenance

The Method of Installing Multiple PHP Versions in LNMP One click Environment

If we have different projects in a server or VPS, different PHP versions may be compatible due to the particularity of the program. Generally, we can directly install PHP versions of common WEB panels at the same time, and then directly install different versions of PHP when adding sites. However, can our common LNMP and Oneinstack scripts achieve such functions?

Theoretically, it can be achieved by installing different PHP versions at the same time, naming different PHP configuration files differently, and then calling the PHP driver version in the site configuration file. Today, Lao Zuo is going to try the latest version of Junge's LNMP to see if it is easy to install multiple versions of PHP and how to implement it.

First, preparations

1. Backup data

Because I am operating in the test environment here. If we are in a production environment with data, we recommend doing a good backup in case of problems.

2. LNMP version

Here I am using the latest version. It is not clear whether the previous version can operate like this.

3. Check the current PHP version

 The Method of Installing Multiple PHP Versions in LNMP One click Environment

Here we see that the current PHP version is 5.6.36

Second, install PHP

./install.sh mphp

 Install PHP

Here we can see the PHP version and install the version that we have not installed. Here I install 7.0. Then execute Enter to install.

 How to Install Multiple PHP Versions Coexisting in LNMP One click Environment - Page 3

The installation is complete.

Third, select PHP to add a site

 How to Install Multiple PHP Versions Coexisting in LNMP One click Environment - Page 4

Here, when we add a site normally, we see that there are two PHP options, and we can choose which one to use as needed.

 How to Install Multiple PHP Versions Coexisting in LNMP One click Environment - Page 5

In fact, in the configuration file, we can see that there is an additional PHP 7.0 file. When we modify the existing site, we can modify the corresponding PHP version in the corresponding site. conf configuration file. It will take effect after restarting LNMP.

Fourth, check whether it is effective

 How to Install Multiple PHP Versions in LNMP One click Environment - Page 6

I see that it is indeed effective.

Vote for you
Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » The Method of Installing Multiple PHP Versions in LNMP One click Environment


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge