安装前准备
centos下执行

yum -y install gcc automake autoconf libtool make

yum -y install gcc gcc-c++ glibc

yum -y install libmcrypt-devel mhash-devel libxslt-devel \
libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel \
zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel \
ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel \
krb5 krb5-devel libidn libidn-devel openssl openssl-devel

新版php-fpm安装

wget http://cn2.php.net/distributions/php-5.6.10.tar.gz
tar zvxf php-5.6.10.tar.gz
cd php-5.6.10
./configure --prefix=/home/fupeng/php --enable-fpm --with-mcrypt \
--enable-mbstring --disable-pdo --with-curl --disable-debug --disable-rpath \
--enable-inline-optimization --with-bz2 --with-zlib --enable-sockets \
--enable-sysvsem --enable-sysvshm --enable-pcntl --enable-mbregex \
--with-mhash --enable-zip --with-pcre-regex --with-mysql --with-mysqli \
--with-gd --with-jpeg-dir

make all

三、修改nginx配置文件以支持php-fpm

nginx安装完成后,修改nginx配置文件为 nginx.conf

其中server段增加如下配置,注意标红内容配置,否则会出现No input file specified.错误

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include

启动php-fpm
/usr/local/php/sbin/php-fpm -D

php-fpm 5.4.7 如何关闭 重启?
php 5.4.7 下的php-fpm 不再支持 php-fpm 以前具有的 /usr/local/php/sbin/php-fpm (start|stop|reload)等命令,需要使用信号控制:
master进程可以理解以下信号
INT, TERM 立刻终止 QUIT 平滑终止 USR1 重新打开日志文件 USR2 平滑重载所有worker进程并重新载入配置和二进制模块

示例:

php-fpm 关闭:

kill -INT ​​cat /usr/local/php/var/run/php-fpm.pid​​​
php-fpm 重启:
kill -USR2 ​​​cat /usr/local/php/var/run/php-fpm.pid​

查看php-fpm进程数:
ps aux | grep -c php-fpm