首頁  >  文章  >  後端開發  >  shell腳本一鍵安裝php7的實例

shell腳本一鍵安裝php7的實例

黄舟
黄舟原創
2017-10-10 09:27:311613瀏覽

下面小編就為大家帶來一篇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的實例的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn