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
Here we see that the current PHP version is 5.6.36
Second, install PHP
./install.sh mphp
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.
The installation is complete.
Third, select PHP to add a site
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.
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
I see that it is indeed effective.
Scan the code to follow the official account
Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge