系统:CentOS Linux release 7.3.1611 内核:3.10.0-514.el7.x86_64 PHP:php-5.3.27.tar.gz

步骤: #yum install -y libxml2 libxml2-devel curl curl-devel freetype freetype-devel libpng libpng-devel libjpeg-devel openssl openssl-devel

下载php: #wget http://am1.php.net/distributions/php-5.3.27.tar.gz #cp php-5.3.27.tar.gz /usr/local/src #cd /usr/local/src #tar -zxvf php-5.3.27.tar.gz #useradd -s /sbin/nologin php-fpm #./configure
--prefix=/usr/local/php
--with-config-file-path=/usr/local/php/etc
--enable-fpm
--with-fpm-user=php-fpm
--with-fpm-group=php-fpm
--with-mysql=/usr/local/mysql
--with-mysql-sock=/tmp/mysql.sock
--with-libxml-dir
--with-gd
--with-jpeg-dir
--with-png-dir
--with-freetype-dir
--with-iconv-dir
--with-zlib-dir
--with-mcrypt
--enable-soap
--enable-gd-native-ttf
--enable-ftp
--enable-mbstring
--enable-exif
--disable-ipv6
--with-pear
--with-curl
--with-openssl #make #make test #make install

编辑配置文件: #cd /usr/local/php/etc/ #cp php-fpm.conf.default php-fpm.conf
#vim /usr/local/php/etc/php-fpm.conf

加入如下配置信息: [global] pid = /usr/local/php/var/run/php-fpm.pid error_log = /usr/local/php/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024

检查配置文件语法是否正确: #/usr/local/php/sbin/php-fpm -t 出现NOTICE: configuration file /usr/local/php/etc/php-fpm.conf test is successful即成功 #cp /usr/local/src/php-5.3.27/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm #chmod 755 /etc/init.d/php-fpm #chmod php-fpm on

启动php-fpm #/etc/init.d/php-fpm start

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

至此,php编译安装完成。