这篇文章给大家分享的是有关shell脚本如何实现一键安装php7的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
如下所示:
#!/bin/bashphp_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_dirrm -rf $source_direcho '===start tar php ========'tar -jxvf $php_gz_file > /dev/nullecho '===end tar php ======='cd $source_direcho '===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 ]thenecho '===start make install==='make install > /dev/nullecho '===end make install==='fiis_finsh_install=$?if [ $is_finsh_install -eq 0 ]thenecho '===start make test===='make test > /dev/nullecho '===end make test====='cp php.ini-production /usr/local/php7/etc/php.inicp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpmchmod +x /etc/init.d/php7-fpmcp /usr/local/php7/etc/php-fpm.conf.default /usr/local/php7/etc/php-fpm.confcp /usr/local/php7/etc/php-fpm.d/www.conf.default /usr/local/php7/etc/php-fpm.d/www.conffi echo done.....
感谢各位的阅读!关于“shell脚本如何实现一键安装php7”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!