-
检查源
brew tap josegonzalez/php
brew tap homebrew/dupes
-
安装 php7
brew install php70 --with-fpm, --with-enchant, --with-debug
安装好之后最后一行会如下图所示:
检查安装好没有,可以看下有没有/usr/local/opt/php@7.0
这个文件夹,有了就是安装成功了。 -
启动 php-fpm
launchctl load -w /usr/local/opt/php70/homebrew.mxcl.php70.plist
// 关闭
launchctl unload -w /usr/local/opt/php70/homebrew.mxcl.php70.plist
- 设置 php-fpm 快捷指令
打开 bash_profile ,把下面的代码粘贴进去
alias php@7.0.start=launchctl\\ load\\ -w\\ /usr/local/opt/php@7.0/homebrew.mxcl.php@7.0.plist
alias php@7.0.stop=launchctl\\ unload\\ -w\\ /usr/local/opt/php@7.0/homebrew.mxcl.php@7.0.plist
- 配置nginx
打开 nginx.conf, 基本只要改一下那个地址就ok了 其他不变
location ~ \\.php$ {
fastcgi_intercept_errors on;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /Users/admin/dt-yunhou-com$fastcgi_script_name;
include fastcgi_params;
}
- 启动 nginx, 启动 php
- 完成!