MacOS install configure php-fpm

php-fpm 是预装在mac os上的,你只需要配置就好了。这个服务监听9000端口。

1. 为配置文件准备一些目录

mkdir -p /usr/share/php/var/run
mkdir -p /usr/share/php/var/log
mkdir -p /usr/share/php/var/session

2. 修改配置文件

cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf

 找到pid等进行如下修改

pid = /usr/share/php/var/run/php-fpm.pid
error_log = /usr/share/php/var/log/php-fpm.log

; 手动启动就设置这个 否则 安装daemon后台运行并设置成yes
daemonize = no

; optionally change listener from port to socket (will require tweaking nginx.conf as well)
listen = 127.0.0.1:9000
; listen = /tmp/php-fpm.sock

;
php_admin_value[session.save_path] = /usr/share/php/var/session

3. 启动fpm

sudo php-fpm

参考:http://verysimple.com/2012/12/06/install-php-fpm-on-osx-10-8-mountain-lion/

PS:安装php的时候如果出现:

An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check theerror log for details.

Faithfully yours, nginx.

是因为php-fpm服务的问题。

原文地址:https://www.cnblogs.com/iosdev/p/3439823.html