安装brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
安装PHP
安装PHP及相关扩展
brew install --without-apache --with-fpm --with-mysql php71
配置PHP命令行工具
echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile && . ~/.bash_profile
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile && . ~/.bash_profile
source ~/.bash_profile
设置php-fpm开机启动
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php71/homebrew.mxcl.php71.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
启动PHP
brew services start homebrew/php/php71
关闭php-fpm进程
killall php-fpm
lsof -Pni4 | grep LISTEN | grep php
重新启动php-fpm进程
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php71.plist
lsof -Pni4 | grep LISTEN | grep php