#!/bin/bash
#######################################
# File Name: php.sh
# Version: V1.0
# Author: sun yun
# Organization:
# Created Time : 2018-04-10 18:33:31
# Description:
#######################################
echo "第一步下载"|pv -qL 25
cd /server/tools
tar xf php-5.6.32.tar.gz
echo "第二步解决依赖关系"|pv -qL 25
yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devel libiconv-devel -y
yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devel libxslt-devel -y
echo "第三步安装加密相关软件依赖"|pv -qL 25
yum -y install libmcrypt-devel mhash mcrypt
#echo "第四步编译安装字符集转换库"|pv -qL 25
#cd /server/tools
#tar zxf libiconv-1.14.tar.gz
#cd libiconv-1.14
#./configure --prefix=/usr/local/libiconv
#make
#make install
#cd ..
echo "第五步进行软件编译安装"|pv -qL 25
cd php-5.6.32
#./configure --prefix=/application/php-5.6.32 --with-mysql=/application/mysql/ --with-pdo-mysql=mysqlnd --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-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --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-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --enable-opcache=no
./configure --prefix=/application/php-5.6.32 --with-mysql=mysqlnd --with-pdo-mysql=mysqlnd --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-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --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-soap --enable-short-tags --enable-static --with-xsl --with-fpm-user=www --with-fpm-group=www --enable-ftp --enable-opcache=no
#echo "第六步安装PHP防错措施" |pv -qL 25
#ln -s /application/mysql/lib/libmysqlclient.so.18 /usr/lib64/
#touch ext/phar/phar.phar
#make && make install
echo "PHP软件程序创建软链接" |pv -qL 25
ln -s /application/php-5.6.32/ /application/php
echo "第七步复制php.ini配置文件到指定目录中" |pv -qL 25
cd /server/tools/php-5.6.32
cp php.ini-production /application/php/lib/php.ini
cd /application/php/etc/
cp php-fpm.conf.default php-fpm.conf
echo "第八步启动" |pv -qL 25
/application/php/sbin/php-fpm