####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