Multi-version PHP coexistence and arbitrary switching with brew in Mac

Source: Internet
Author: User
Tags fpm install brew

1. Install Brew

Reference Link: https://brew.sh/index_zh-cn.html

2. Installing PHP56
Install homebrew/php/php56
3. Configure PHP56

Because we need to co-exist with other PHP versions, we need to modify the PHP-FPM listening port)

Brew installed software catalogs generally in/usr/local/cellar, configuration files generally in/USR/LOCAL/ETC

Enter/usr/local/etc/php/5.6/

Modify Php-fpm.conf

Listen = 127.0.0.1:9001

Start php56

Brew Services Start PHP56

At this time PHP-FPM will listen to 9001 ports, corresponding Nginx configuration should also be changed to the request Port 9001

4. Installing php71

First Execute

unlink php56

Clear the php56 soft chain, this operation has no effect on the software itself

Installing php71

Install homebrew/php/php71

Start php71 after installation is complete

Brew Services Start php71

Then php71 's FPM will listen on port 9000.

At this point, 2 versions exist at the same time

5. Switching the environment

At this point, the version that the execution php-v sees is php71

Switch to PHP56

unlink php71brew Link php56

Two commands, directly, and then execute PHP-V will see that the current PHP environment is PHP56

In the same vein, it's easy to cut back php71.

6. Service Management

Brew itself contains service management

Brew Services List

You can view the currently managed services, and you can see the startup status

The corresponding software can then be started and closed via start,stop etc.

Summary: Brew is a powerful tool

Multi-version PHP coexistence and arbitrary switching with brew in Mac

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.