安装lib库
yum install zlib-devel libxml2-devel libjpeg-turbo-devel freetype-devel libpng-devel gd-devel -y
下载libiconv包
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gztar xf libiconv-1.14.tar.gzcd libconv-1.14./configure --prefix=/usr/local/libiconvmakemake install
设置epel源
wget -O /etc/yum.repos.d/epel.repo
安装libmcrypt库、安装加密扩展库mhash、安装mcrypt扩展库、安装libxstl-devel
yum install libmcrypt libmcrypt-devel mhash mhash-devel mcrypt libxstl-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/lib64makemake install
创建PHP的软连接
ln -s /application/php.5.3.27 /application/php
配置PHP.INI文件(从安装目录中复制ini文件模版。结尾是development是用于开发的,production是用于生产环境的)
cd ~/php.5.3.27cp php.ini-production /application/php/lib/php.ini
配置PHP服务(fastcgi模式)配置文件php-fpm.conf
cd /application/php/etccp php-fpm.conf.default php-fpm.conf
修改必要的参数后启动php-fpm
/application/php/sbin/php-fpm
检查启动的进程(一个主进程,16个子进程,在php-frm.conf中配置)
ps -ef|grep php-fpm|grep -v grep #查看进程ps -ef|grep php-fpm|grep -v grep|wc -l #检查进程数
查看端口(端口默认9000)
netstat -lntup|grep php-fpmss -lntup|grep php-fpm