欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

shell脚本一键安装php7的实例

程序员文章站 2022-04-29 15:04:36
...
下面小编就为大家带来一篇shell脚本一键安装php7的实例(推荐)。小编觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随小编过来看看吧

如下所示:

#!/bin/bash


php_gz_file='/home/php/Downloads/source/php-7.0.0.tar.bz2'
tar_dir='/home/php/Downloads/dst/'
source_dir='php-7.0.0'


cd $tar_dir
rm -rf $source_dir


echo '===start tar php ========'
tar -jxvf $php_gz_file > /dev/null
echo '===end tar php ======='


cd $source_dir
echo '===echo start configure php======= '


./configure --prefix=/usr/local/php7 \
 --with-config-file-path=/usr/local/php7/etc \
 --with-config-file-scan-dir=/usr/local/php7/etc/conf.d \
 --enable-fpm \
 --enable-opcache \
 --with-apxs2=/usr/local/apache/bin/apxs \
 --with-curl \
 --with-mysqli=mysqlnd \
 --with-pdo-mysql=mysqlnd \
 --enable-session \
 --enable-mbstring \
 --enable-sockets \
 --with-gd \
 --with-iconv \
 --with-openssl \
 --enable-soap \
> /dev/null 




echo ' ===end configrue php===== '
 


echo '=== start make ==== '




make > /dev/null 


echo '==end make test'




if [ $? -eq 0 ]
then


echo '===start make install==='
make install > /dev/null


echo '===end make install==='
fi


is_finsh_install=$?


if [ $is_finsh_install -eq 0 ]
then
echo '===start make test===='
make test > /dev/null
echo '===end make test====='
cp php.ini-production /usr/local/php7/etc/php.ini
cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm
chmod +x /etc/init.d/php7-fpm
cp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.conf
cp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conf
fi
echo done.....

以上就是shell脚本一键安装php7的实例的详细内容,更多请关注其它相关文章!

相关标签: shell php7 php