LNMP one-click environment installation method for coexistence of multiple PHP versions

888u

Last update at :2024-07-06,Edit by888u

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

Theoretically, it can be achieved. You only need to install different PHP versions at the same time, then name the different PHP configuration files differently, and then call the PHP driver version in the site configuration file. Today, Snail is going to try the latest version of LNMP on Brother Jun to see if it is easy to install multiple versions of PHP and how to achieve it.

First, preparations

1. Back up data

Because I am operating in a test environment here, if we are in a production environment with data, it is recommended to make a backup in case something goes wrong.

2. LNMP version

I am using the latest version here. I don’t know if this can be done in previous versions.

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 see the PHP version clearly and install the version we have not installed. Here I install 7.0. Then press Enter to install.

This completes the installation.

Third, add site selection PHP

Here we see that there are 2 PHPs to choose from when adding a site normally. We can choose which one to use according to our needs.

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

Fourth, check whether it is effective

See that it has indeed taken effect.

Recommended site searches: domain name transactions, Hong Kong high-defense server rental, domain name registration, independent IP space, foreign free cloud servers, Hong Kong cn2 servers, virtual host control panel, Guangzhou server hosting, US host purchase, same IP website query,

LNMP one-click environment installation method for coexistence of multiple PHP versions

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码