mdserver-web/plugins/php/versions/70/install.sh

80 lines
1.8 KiB
Bash
Raw Normal View History

2018-11-27 06:20:46 -05:00
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source
2019-03-13 00:38:03 -04:00
sysName=`uname`
2019-03-12 04:28:48 -04:00
install_tmp=${rootPath}/tmp/mw_install.pl
2018-11-27 06:20:46 -05:00
Install_php()
{
#------------------------ install start ------------------------------------#
2019-03-06 01:29:47 -05:00
echo "安装php-7.0.30 ..." > $install_tmp
2018-11-27 06:20:46 -05:00
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
2019-03-06 01:29:47 -05:00
if [ ! -f $sourcePath/php/php-7.0.30.tar.xz ];then
wget -O $sourcePath/php/php-7.0.30.tar.xz https://museum.php.net/php7/php-7.0.30.tar.xz
2018-11-27 06:20:46 -05:00
fi
2019-03-06 01:29:47 -05:00
if [ ! -d $sourcePath/php/php-7.0.30 ];then
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-7.0.30.tar.xz
2018-11-27 06:20:46 -05:00
fi
2019-03-13 00:38:03 -04:00
OPTIONS=''
if [ $sysName == 'Darwin' ]; then
OPTIONS='--without-iconv'
2019-03-13 02:38:02 -04:00
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
2019-03-13 00:38:03 -04:00
else
OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
2019-03-13 01:09:37 -04:00
OPTIONS="${OPTIONS} --with-gd --enable-gd-native-ttf"
2019-03-13 02:38:02 -04:00
OPTIONS="${OPTIONS} --with-curl"
2019-03-13 00:38:03 -04:00
fi
2018-11-27 06:20:46 -05:00
2019-03-06 01:29:47 -05:00
cd $sourcePath/php/php-7.0.30 && ./configure \
--prefix=$serverPath/php/70 \
--exec-prefix=$serverPath/php/70 \
--with-config-file-path=$serverPath/php/70/etc \
2018-11-27 06:20:46 -05:00
--with-zlib-dir=$serverPath/lib/zlib \
2019-03-06 01:29:47 -05:00
--enable-mysqlnd \
2018-11-27 06:20:46 -05:00
--enable-zip \
--enable-mbstring \
2019-03-13 01:09:37 -04:00
--enable-simplexml \
2018-11-27 06:20:46 -05:00
--enable-ftp \
2019-03-11 01:43:04 -04:00
--enable-sockets \
--enable-intl \
2018-11-27 06:20:46 -05:00
--enable-wddx \
--enable-soap \
--enable-posix \
2019-03-12 02:52:02 -04:00
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
2019-03-13 00:38:03 -04:00
$OPTIONS \
2018-11-27 06:20:46 -05:00
--enable-fpm \
2019-03-06 01:29:47 -05:00
&& make && make install && make clean
2018-11-27 06:20:46 -05:00
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
2019-03-12 04:28:48 -04:00
$serverPath/php/init.d/php70 stop
2019-03-06 01:29:47 -05:00
rm -rf $serverPath/php/70
echo "卸载php-7.0.30 ..." > $install_tmp
2018-11-27 06:20:46 -05:00
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi