折騰了好幾天還是沒把 php 的 openssl 擴(kuò)展給裝上,感覺 openssl 和 brew install openssl 的不一致蹬挤,安裝總是失敗。是在受不了,把 Mac 升級(jí)到 Sierra 10.13碉渡, Xcode 顯示完全刪除,再重新安裝 Xcode 7.3母剥。開始提示安裝 Xcode 時(shí)間需要大概 10 個(gè)小時(shí)滞诺,時(shí)間也是在波動(dòng)形导,后來發(fā)現(xiàn)暫停后再下載,速度提升很多习霹,終于一個(gè)多小時(shí)就把 Xcode 給裝上了朵耕,因?yàn)?brew 安裝 php 對(duì) Xcode 有依賴。
==> Installing dependencies for php@7.1: aspell, freetds, libpng, freetype, libffi,
pcre, glib, gmp, icu4c, jpeg, libpq, libtool, libzip, mhash, mcrypt, unixodbc, webp
chmod: Unable to change file mode on ./php: Operation not permitted
System Integrity Protection (SIP), is a new feature in El Capitan that protects system processes and folders so even a root user cannot get access to them.
Reboot your Mac into Recovery Mode by restarting your computer and holding down Command+R until the Apple logo appears on your screen.
Click Utilities > Terminal.
csrutil disable
brew 安裝 php7(libphp7.so丟失)
brew install php71 --with-apxs2 --with-apache --with-gmp --with-imap --with-tidy --with-debug --with-openssl
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php@7.1/lib/httpd/modules/libphp7.so
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini and php-fpm.ini file can be found in:
/usr/local/etc/php/7.1/
This formula is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.
If you need to have this software first in your PATH run:
echo 'export PATH="/usr/local/opt/php@7.1/bin:PATH"' >> ~/.bash_profile echo 'export PATH="/usr/local/opt/php@7.1/sbin:PATH"' >> ~/.bash_profile
For compilers to find this software you may need to set:
LDFLAGS: -L/usr/local/opt/php@7.1/lib
CPPFLAGS: -I/usr/local/opt/php@7.1/include
To have launchd start php@7.1 now and restart at login:
brew services start php@7.1
Or, if you don't want/need a background service you can just run:
php-fpm
502 Bad Gateway
修改php-fpm的配置文件 vim /usr/local/php/etc/php-fpm.conf 里面的 listen = /tmp/php-fcgi.sock 改為 listen = 127.0.0.1:9000
修改nginx的配置文件 vim /usr/local/nginx/conf/nginx.conf 里面的 fastcgi_pass unix:/tmp/php-fcgi.sock; 改為 fastcgi_pass 127.0.0.1:9000;
重啟 php-fpm
master進(jìn)程可以理解以下信號(hào)
INT, TERM 立刻終止
QUIT 平滑終止
USR1 重新打開日志文件
USR2 平滑重載所有worker進(jìn)程并重新載入配置和二進(jìn)制模塊
ps -ef | grep php-fpm
找到 master 主進(jìn)程
kill -USR2 端口號(hào)
啟動(dòng) php-fpm
/usr/sbin/php-fpm