#!/bin/sh echo "----------------------------------start install php -----------------------------" yum -y install gcc make gd-devel libjpeg-devel libpng-devel libxml2-devel bzip2-devel libcurl-devel libaio yum -y install libmcrypt-devel yum -y install libmcrypt-devel yum -y groupinstall "Development Tools" if [ 'grep "php-fpm" /etc/passwd | wc -l' ]; then echo "adding user php-fpm" groupadd php-fpm useradd -s /sbin/nologin -M -g php-fpm php-fpm else echo "user php-fpm exsits" fi echo "-----------------------------------downloading php-------------------------------" wget http://cn2.php.net/distributions/php-5.6.2.tar.gz tar -xvf php-5.6.2.tar.gz cd php-5.6.2 echo "------------------------------------configuring php,plz wait----------------------" ./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=mysqlnd --with-mysql-sock=/tmp/mysql.sock if [ $? -ne 0 ];then echo "configure failed ,please check it out!" else echo "make php, please wait for 20 minutes" make fi if [ $? -ne 0 ];then echo "make failed ,please check it out!" else echo "install php, please wait for 20 minutes" make install fi chown -R php.php /usr/local/php 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 755 /etc/init.d/php-fpm service php-fpm start chkconfig php-fpm on