Example of one-click installation of php7 using shell script

黄舟
Release: 2023-03-16 15:08:01
Original
1589 people have browsed it

The following editor will bring you an example of one-click installation of php7 using a shell script (recommended). The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.

is as follows:

#!/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.....
Copy after login

The above is the detailed content of Example of one-click installation of php7 using shell script. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!