####Mac下編譯安裝php-7.0php
php7.0 不在支持取消mysql直連擴展,請使用mysqli 或者pdo方式鏈接數據庫html
./configure --prefix=/usr/local/php --with-config-file-path=/etc/php --enable-fpm --enable-pcntl --enable-mysqlnd --enable-opcache --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-shmop --enable-zip --enable-ftp --enable-soap --enable-xml --enable-mbstring --disable-rpath --disable-debug --disable-fileinfo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-pcre-regex --with-iconv --with-zlib --with-mcrypt --with-gd --with-mhash --with-xmlrpc --with-curl --with-imap-ssl
sudo make && make install
建立配置文件,並將其複製到正確的位置mysql
cp php.ini-development /usr/local/php/php.ini cp /usr/local/php/etc/php-fpm.conf.default /usr/local/etc/php-fpm.conf cp sapi/fpm/php-fpm /usr/local/bin
到此PHP就安裝完成了 #####Nginxnginx
經過home brew 來安裝nginx brew install nginx
修改默認的location塊,使其支持.php文件sql
location / { root html; index index.php index.html index.htm; }
配置.php文件請求被傳送到後端的php-fpm模塊取消默認的php配置快的註釋數據庫
location ~* \.php$ { fastcgi_index index.php; fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; }
啓動php-fpm後端
/usr/local/bin/php-fpm
啓動nginxapi
sudo nginx //啓動nginx small tips: 重啓nginx:sudo nginx -s reload
附錄:php7
須要將/usr/local/etc/php-fpm.d/下的www.conf.default.conf 更名爲www.confcurl
3.WARNING: Nothing matches the include pattern '/usr/local/etc/php-fpm.d/*.conf' from /usr/local/etc/php-fpm.conf at line 125. ERROR:. No pool defined at least one pool section must be specified in config file ERROR: failed to post process the configuration ERROR: FPM initialization failed solution: cp www.conf.default www.conf