Linux Multi-version PHP switching ____linux

Source: Internet
Author: User

PHP developers often encounter this situation, the development of the language is sometimes 5.3, sometimes 5.6. You can't always reinstall PHP every time you switch versions.
Fortunately there is a solution, that is, in the system to compile multiple versions of PHP, in the switch only need to modify the shortcut on it.

First, multiple versions of PHP are compiled in the system to handle different environments.

Want to switch the PHP version of the system. There are several places that need to be changed respectively. PHP version used in HTTP

The general Nginx is to use PHP-FPM to run PHP, so you need to add the correct php-fpm to/ETC/RC.D/INIT.D.
Maybe it's not here.

So first find the location of PHP-FPM:
Command: PHP-FPM Find/-name ' PHP-FPM '

When you find it, stop it first.
Command: PHP-FPM stop

Delete it. Add PHP-FPM to the correct version that you want.
Command: Ls-s/a/apps/php-5.4.41/sbin/init.d.php-fpm php-fpm

And then run
PHP-FPM start II, PHP used in the CLI, which is the command line

Generally in Usr/bin usr/local/bin. Look for it yourself anyway.
Also change the soft connection can be.

After this process, I found a good problem. So think of a good way. Anyway, all the places in the system that use PHP are the way to build a soft connection from these PHP programs. So I set up a unified portal for these different versions.

So the other soft connections point to this PHP. This PHP soft connection acts as an interface.
Then I need to switch versions of the time. Just point to the correct version of this PHP. Because you never know how many places to change.
(I was also known by the pit)
* Note to reboot PHP-FPM

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.