mac 安裝 php 環境
阿新 • • 發佈:2018-11-22
檢查源
brew tap josegonzalez/php
brew tap homebrew/dupes
安裝 php7
brew install php70 --with-fpm, --with-enchant, --with-debug
安裝好之後最後一行會如下圖所示:
檢查安裝好沒有,可以看下有沒有/usr/local/opt/[email protected]
這個資料夾,有了就是安裝成功了。- 啟動 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 [email protected]=launchctl\ load\ -w\ /usr/local/opt/[email protected]/[email protected]
alias [email protected]=launchctl\ unload\ -w\ /usr/local/opt/[email protected]/[email protected]
- 配置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
- 完成!