The Mac comes with php5.6, and here's what to do if you want to upgrade to php7.1.
1. Install Brew
https://brew.sh/(the official website is provided with the installation command recommended)
" $ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install) "
2, the installation after the introduction of the Brew command (this is very important, do not skip)
Brew Update#Update Brew installable packages, it is recommended to execute each timeBrew Search Php71#Search php7.1Brew Tap josegonzalez/php#Install extensions <gihhub_user/repo>Brew Tap#View the list of installed extensionsBrew Install php71#Installing php7.1Brew Remove php71#Uninstalling php7.1Brew Upgrade Php71#Upgrade php7.1Brew Options Php71#View php7.1 installation optionsBrew Info php71#View php7.1 Related informationBrew Home php71#Visit php7.1 official websiteBrew Services List#View System-installed services through brewBrew Services Cleanup#clear uninstalled unused boot configuration filesBrew Services Restart PHP71#Restart php-fpm
3. PHP Installation
Add PHP Extension
Brew updatebrew Tap homebrew/dupesbrew tap homebrew/phpbrew tap Josegonzalez/homebrew-php
#先查询php71安装的选项. The options that follow determine whether PHP generates PHP7 extensions.
Brew Options Php71
--with-apache Brew options php71 option, do not choose the wrong.
Brew Install php71--with-apache
Ruby-e"$ (curl-fssl https://raw.githubusercontent.com/Homebrew/install/master/install)"
Install Apache and PHP via brew under Mac