执行就完事了!
#!/bin/bash
#20190807
#LiangZeYu
#2249902650
#php install script
#install php7.tar.gz
[ -f /etc/init.d/functions ]&& . /etc/init.d/functions
read -p "QAQ --> 您好,本本脚本是编译安装php7.0,依赖包全部yum,是否确认安装 : yes/no " affirm
if [ $affirm != yes ];then
exit
fi
wget -O php7.tar.gz http://cn2.php.net/get/php-7.0.4.tar.gz/from/this/mirror -P /opt/
mv php7.tar.gz /opt
if [ $? -ne 0 ];then
action "install php70 failed" /bin/false
exit
else
action "install php70 succed" /bin/true
fi
yum install libxml2 libxml2-devel openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel gmp gmp-devel libmcrypt libmcrypt-devel readline readline-devel libxslt libxslt-devel -y
if [ $? -eq 0 ];then
action "install rely package succeed" /bin/true
else
action "install rely package failed" /bin/false
fi
cd /opt
tar -zxf php7.tar.gz
pushd /opt/php-7.0.4
./configure \
--prefix=/usr/local/php \
--with-config-file-path=/etc \
--enable-fpm \
--with-fpm-user=www \
--with-fpm-group=www \
--enable-inline-optimization \
--disable-debug \
--disable-rpath \
--enable-shared \
--enable-soap \
--with-libxml-dir \
--with-xmlrpc \
--with-openssl \
--with-mcrypt \
--with-mhash \
--with-pcre-regex \
--with-sqlite3 \
--with-zlib \
--enable-bcmath \
--with-iconv \
--with-bz2 \
--enable-calendar \
--with-curl \
--with-cdb \
--enable-dom \
--enable-exif \
--enable-fileinfo \
--enable-filter \
--with-pcre-dir \
--enable-ftp \
--with-gd \
--with-openssl-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib-dir \
--with-freetype-dir \
--enable-gd-native-ttf \
--enable-gd-jis-conv \
--with-gettext \
--with-gmp \
--with-mhash \
--enable-json \
--enable-mbstring \
--enable-mbregex \
--enable-mbregex-backtrack \
--with-libmbfl \
--with-onig \
--enable-pdo \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir \
--with-pdo-sqlite \
--with-readline \
--enable-session \
--enable-shmop \
--enable-simplexml \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--with-libxml-dir \
--with-xsl \
--enable-zip \
--enable-mysqlnd-compression-support \
--with-pear \
--enable-opcache
make && make install
if [ $? -eq 0 ];then
action "compole install php7 succeed" /bin/true
else
action "compole install php7 succeed" /bin/false
fi
popd
echo 'export PATH=/usr/local/php/bin:$PATH' >>/etc/profile
source /etc/profile
cp /opt/php-7.0.4/php.ini-production /etc/php.ini
cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf
cp /opt/php-7.0.4/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm
chmod +x /etc/init.d/php-fpm
/etc/init.d/php-fpm start
if [ $? -eq 0 ];then
action "start php7 succed" /bin/true
else
action "start php7 faild" /bin/failed
fi
有问题请加博主微信进行沟通!
全部评论