Change the PHP version in linux and switch multiple PHP versions.

Source: Internet
Author: User
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--prefixSpecify 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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.