shell脚本一键安装php7的实例(推荐)

所属分类: 脚本专栏 / linux shell 阅读数: 533
收藏 0 赞 0 分享

如下所示:

#!/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的实例(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。

更多精彩内容其他人还在看

Linux shell中的printf的详细用法

这篇文章主要介绍了Linux shell中的printf的详细用法的相关资料,希望能通过本文能帮助到大家,需要的朋友可以参考下
收藏 0 赞 0 分享

shell字符截取命令之cut命令的实例详解

这篇文章主要介绍了shell字符截取命令之cut命令的实例详解的相关资料,希望通过本文大家能够掌握这部分内容,需要的朋友可以参考下
收藏 0 赞 0 分享

Linux 在Bash脚本中怎么关闭文件描述符的实例

这篇文章主要介绍了Linux 在Bash脚本中怎么关闭文件描述符的实例的相关资料,希望通过本文能帮助到大家实现这样的功能,需要的朋友可以参考下
收藏 0 赞 0 分享

Linux使用文本编辑器vi常用命令

vi就是一种功能强大的文本编辑器,而vim则是高级版的vi,不但可以用不同颜色显示文字内容,还能进行诸如shell脚本、C语言程序编辑等功能,可以作为程序编辑器。下面通过本文给大家介绍linux 文本编辑器vi常用命令,一起看看吧
收藏 0 赞 0 分享

Linux 中unzip解压时中文乱码的解决办法

这篇文章主要介绍了Linux 中unzip解压时中文乱码的解决办法的相关资料,这里提供两种解决办法,希望能通过本文帮助到大家,需要的朋友可以参考下
收藏 0 赞 0 分享

Linux shell ftp命令根据文件日期下载文件的方法

最近做项目遇到这样的需求要求ftp获取远程数据的文件,根据文件的创建时间点下载文件。下面小编给大家分享知识点小结,感兴趣的朋友要求看看吧
收藏 0 赞 0 分享

Linux下服务器重启的脚本命令

Linux关闭和重启系统一般使用相同的命令可以实现。下面脚本之家小编给大家带来了Linux下服务器重启的脚本命令,感兴趣的朋友一起看看吧
收藏 0 赞 0 分享

Linux中的特殊符号与正则表达式

这篇文章主要介绍了Linux中的特殊符号与正则表达式,需要的朋友可以参考下
收藏 0 赞 0 分享

利用shell命令统计日志的方法详解

这篇文章主要给大家介绍了关于利用shell命令统计日志的方法,通过这个命令将会对大家的学习或者工作具有一定的参考学习价值,文中给出了详细的示例代码,需要的朋友可以参考借鉴,下面随着小编来一起学习学习吧。
收藏 0 赞 0 分享

Linux中的Syslog命令

syslog是Linux系统默认的日志守护进程,默认的syslog配置文件是/etc/syslog.conf文件。接下来通过本文给大家分享Linux中的Syslog命令,感兴趣的朋友一起看看吧
收藏 0 赞 0 分享
查看更多