centos 7.0 64位 php5.6.21编译安装

!/bin/bash

#install_php-5.6.21.tar.gz

cp -frp /usr/lib64/libldap* /usr/lib/
//源码包放在/usr/local/mysql
cd /usr/local/src
tar xzvf php-5.6.21.tar.gz
cd php-5.6.21
./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir=/usr/local --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-gd --enable-gd-native-ttf --with-libxml-dir=/usr --enable-xml --disable-rpath --enable-discard-path --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-ldap --with-ldap-sasl --with-xmlrpc --enable-zip --enable-soap --without-pear
sed -i 's/^EXTRA_LIBS =.*/& -llber/' $SOURCE_DIR/php-5.6.21/Makefile
make
make install

cp php.ini-production /usr/local/php/etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default  /usr/local/php/etc/php-fpm.conf
cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm

chkconfig --add php-fpm
chkconfig php-fpm on

编译安装完成后启动php-fpm

/etc/init.d/php-fpm start
//查看php-fpm启动是否成功
ps aux | grep php-fpm
nestat -tnlp | grep 127.0.0.1:9000