How can I change the PHP version and switch to different PHP versions in linux? For example, if my current PHP version is 5.3 and I want to change it to 5.5, can I switch between these two versions? In my current situation, the centos6.5php version is 5.3 and I want to upgrade to 5.5. How can I change the PHP version and switch to another PHP version in linux?
For example, if my current PHP version is 5.3 and I want to change it to 5.5, can I switch between these two versions?
I want to upgrade centos6.5 php to 5.3.
Reply content:
How can I change the PHP version and switch to different PHP versions in linux?
For example, if my current PHP version is 5.3 and I want to change it to 5.5, can I switch between these two versions?
I want to upgrade centos6.5 php to 5.3.
Compile php--prefix
Specify different directories and install different php files to different directories. You need to run php files in the version directory when running php.
Docker is a good choice
If lnmp is used, a troublesome method is introduced.
1. install different versions of php. Select the installation directory when compiling -- prefix
2. When starting php-fpm, configure different port numbers in php-fpm-config. The default value is 127.0.0.1: 9000. You can set php5.5 to 127.0.0.1: 9055 and php5.6 to 127.0.0.1: 9056. And so on.
3. When switching, modify the nginx configuration file to forward the PHP file, for example, change 127.0.0.1: 9055 to 127.0.0.1: 9056.
There are scripts in the lnmp installation. If you don't want to install so many scripts, let's see how they are written in the lnmp PHP version switch script. Can you refer to it for reference?
Install the new version separately, and then update
~/.bashrc
File