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