1.卸载自带的php
rpm -qa|grep php
yum -y remove php*
2.tar zxvf libiconv-1.14.tar.gz
cd libiconv-1.14
./configure prefix=/usr/local/libiconv
make && make install
3.tar -zxvf libxml2-2.6.30.tar.gz
cd libxml2-2.6.30
./configure prefix=/usr/local/libxml2/ –enable-shared
make
make install
4./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-mysql=/usr/include/mysql –with-mysqli=/usr/bin/mysql_config –with-mysql-sock=/var/lib/mysql/mysql.sock –with-jpeg-dir –with-iconv=/usr/local/libiconv/ –with-libxml-dir=/usr/local/libxml2 –with-zlib –with-png-dir –with-curl –with-ldap –with-xmlrpc –with-openssl –with-mhash –with-mcrypt –with-freetype-dir –with-ldap-sasl –with-curlwrappers –enable-xml –enable-shared –enable-discard-path –enable-safe-mode –enable-bcmath –enable-sysvsem –enable-inline-optimization –enable-mbregex –enable-fastcgi –enable-fpm –enable-force-cgi-redirect –enable-mbstring=all –enable-pcntl –enable-sockets –enable-zip –enable-soap
cp php.ini-dist /usr/local/php/etc/php.ini
#修改php-fpm.conf
vi /usr/local/php/etc/php-fpm.conf
#查找63,66行将注释去掉
nobody
nobody
5 vi /etc/profile #把php/php-fpm服务加入系统环境变量:在最后添加下面这一行
export PATH=$PATH:/usr/local/php/bin
export PATH=$PATH:/usr/local/php/sbin
. /etc/profile #使其生效
/usr/local/php/sbin/php-fpm start