Mac OS X 10.9自帶php-fpm的配置使用和擴充套件安裝
阿新 • • 發佈:2019-02-08
#測試php-fpm配置
php-fpm -t
php-fpm -c /usr/local/etc/php/5.5/php.ini -y /usr/local/etc/php/5.5/php-fpm.conf -t
#啟動php-fpm
php-fpm -D
php-fpm -c /usr/local/etc/php/5.5/php.ini -y /usr/local/etc/php/5.5/php-fpm.conf -D
#關閉php-fpm
kill -INT `cat /usr/local/var/run/php-fpm.pid`
#重啟php-fpm
kill -USR2 `cat /usr/local/var/run/php-fpm.pid`
#也可以用上文提到的brew命令來重啟php-fpm,不過他官方不推薦用這個命令了
brew services restart php55
#還可以用這個命令來啟動php-fpm
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
啟動php-fpm之後,確保它正常執行監聽9000埠:
lsof -Pni4 | grep LISTEN | grep php
php-fpm 30907 calvin 9u IPv4 0xf11f9e8e8033a2a7 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 30917 calvin 0u IPv4 0xf11f9e8e8033a2a7 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 30918 calvin 0u IPv4 0xf11f9e8e8033a2a7 0t0 TCP 127.0.0.1:9000 (LISTEN)
php-fpm 30919 calvin 0u IPv4 0xf11f9e8e8033a2a7 0t0 TCP 127.0.0.1:9000 (LISTEN)
#正常情況,會看到上面這些程序
PHP-FPM開機啟動:
ln -sfv /usr/local/opt/php55/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php55.plist
安裝php composer
brew install composer
#檢查一下情況
composer --version
Composer version 1.0.0-alpha8 2014-01-06 18:39:59
redis memcached這些軟體brew 已經自動依賴安裝上,如果想開機自動啟動,或者檢視使用說明
brew info redis
即可。另外,composer的中文文件:猛戳這裡
安裝Nginx
brew install nginx --with-http_geoip_module
Nginx啟動關閉命令:
#測試配置是否有語法錯誤
nginx -t
#開啟 nginx
sudo nginx
#重新載入配置|重啟|停止|退出 nginx
nginx -s reload|reopen|stop|quit
#也可以使用Mac的launchctl來啟動|停止
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
Nginx開機啟動
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
Nginx監聽80埠需要root許可權執行,因此:
sudo chown root:wheel /usr/local/Cellar/nginx/1.6.0_1/bin/nginx
sudo chmod u+s /usr/local/Cellar/nginx/1.6.0_1/bin/nginx