安装lib库

yuminstallzlib-devellibxml2-devellibjpeg-turbo-develfreetype-devellibpng-develgd-devel-y


下载libiconv包

wgethttp://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztarxflibiconv-1.14.tar.gzcdlibconv-1.14./configure--prefix=/usr/local/libiconvmakemakeinstall

设置epel源

wget-O/etc/yum.repos.d/epel.repo

安装libmcrypt库、安装加密扩展库mhash、安装mcrypt扩展库、安装libxstl-devel

yuminstalllibmcryptlibmcrypt-develmhashmhash-develmcryptlibxstl-devel-y


PHP编译指令

./configure\--prefix=/application/php5.3.27\--with-mysql=/application/mysql\--with-iconv-dir=/usr/local/libiconv\--with-freetype-dir\--with-jpeg-dir\--with-png-dir\--with-zlib\--with-libxml-dir=/usr--enable-xml\--disable-rpath\--enable-safe-mode\--enable-bcmath\--enable-shmop\--enable-sysvsem\--enable-inline-optimization\--with-curl\--with-curlwrappers\--enable-mbregex\--enable-fpm\--enable-mbstring\--with-mcrypt\--with-gd\--enable-gd-native-ttf\--with-openssl\--with-mhash\--enable-pcntl\--enable-sockets\--with-xmlrpc\--enable-zip\--enable-soap\--enable-short-tags\--enable-zend-multibyte\--enable-static\--with-xsl\--with-fpm-user=nginx\--with-fpm-group=nginx\--enable-ftp

在Make之前创建软连接,否则可能报错

ln-s/application/mysql/lib//libmysqlclient.so.18/usr/lib64makemakeinstall

创建PHP的软连接

ln-s/application/php.5.3.27/application/php

配置PHP.INI文件(从安装目录中复制ini文件模版。结尾是development是用于开发的,production是用于生产环境的)

cd~/php.5.3.27cpphp.ini-production/application/php/lib/php.ini

配置PHP服务(fastcgi模式)配置文件php-fpm.conf

cd/application/php/etccpphp-fpm.conf.defaultphp-fpm.conf

修改必要的参数后启动php-fpm

/application/php/sbin/php-fpm

检查启动的进程(一个主进程,16个子进程,在php-frm.conf中配置)

ps-ef|grepphp-fpm|grep-vgrep#查看进程ps-ef|grepphp-fpm|grep-vgrep|wc-l#检查进程数

查看端口(端口默认9000)

netstat-lntup|grepphp-fpmss-lntup|grepphp-fpm