第一步:安装所需的包
yum install wget make gcc gcc-c++bison autoconf patch \
pcre-devel zlib-devel openssl-devel net-snmp-devel \
ncurses-devel libxml2-devel bzip2-devel gd-devel libcurl-devel \
mysql-devel memcached libtool-ltdl-devel
第二步:安装libmcrypt
mkdir ~/down
cd~/down
wget http://downloads.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8./configure
make
make install
第三步:下载php-5.2.17以及php-fpm补丁包
mkdir ~/down
cd~/down
wget http://museum.php.net/php5/php-5.2.17.tar.bz2
tar jxvf php-5.2.17.tar.bz2
wget http://php-fpm.org/downloads/php-5.2.17-fpm-0.5.14.diff.gz
gzip -cd php-5.2.17-fpm-0.5.14.diff.gz | patch -d php-5.2.17 -p1
第四步:编译安装PHP
对于64位系统的CentOS需要执行
ln -s /usr/lib64/libjpeg.so /usr/lib/ln-s /usr/lib64/libpng.so /usr/lib/ln-s /usr/lib64/mysql/libmysqlclient.so.16.0.0 /usr/lib/libmysqlclient.so
然后执行下面编译
cd ~/down/php-5.2.17./configure --prefix=/usr/local/php --enable-fastcgi \--enable-fpm --enable-gd-native-ttf --enable-gd-jis-conv --enable-soap \--enable-zip --enable-pcntl --enable-sockets --enable-mbstring --enable-xml \--with-bz2 --with-openssl --with-iconv --with-zlib --with-curl \--with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-mcrypt \--with-mysql --with-mysqli
make
make install
第七步:配置php-fpm扩展
编辑文件/usr/local/php/etc/php-fpm.conf
找到下面代码
Unix user of processesUnix group of processes
去掉里面的