一、安装php-fpm依赖包
yum install -y make cmake gcc gcc-c++ autoconf automake libpng-devel libjpeg-devel zlib libxml2-devel ncurses-devel bison libtool-ltdl-devel libiconv libmcrypt mhash mcrypt pcre-devel openssl-devel freetype-devel libcurl-devel
二、下载源码
wget http://cn2.php.net/distributions/php-5.6.6.tar.gz
tar -zxvf php-5.6.6.tar.gz
cd ./php-5.6.6/
三、编译安装
# 配置php的编译参数
./configure --prefix=/usr/local/php --with-mysql --with-mysqli --with-pdo_mysql --with-iconv-dir --with-zlib --with-libxml-dir --enable-xml --with-curl --enable-fpm --enable-mbstring --with-gd --with-openssl --with-mhash --enable-sockets --with-xmlrpc --enable-zip --enable-soap --with-freetype-dir=/usr/lib64
# 开始编译安装
make
make install
四、配置php-fpm
#到php的配置目录
cd /usr/local/php/etc
#有一个php-fpm.conf.default的文件,cp复制
cp php-fpm.conf.default php-fpm.conf
#编辑 php-fpm.conf
#找到以下配置项, 配置如下
pid = run/php-fpm.pid
五、启动php-fpm
/usr/local/php/sbin/php-fpm