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

84 lines
1.9 KiB
Bash
Raw Normal View History

2018-11-28 08:35:26 -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-28 08:35:26 -05:00
Install_php()
{
#------------------------ install start ------------------------------------#
echo "安装php-5.6.36 ..." > $install_tmp
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
if [ ! -f $sourcePath/php/php-5.6.36.tar.xz ];then
wget -O $sourcePath/php/php-5.6.36.tar.xz https://museum.php.net/php5/php-5.6.36.tar.xz
fi
if [ ! -d $sourcePath/php/php-5.6.36 ];then
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-5.6.36.tar.xz
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-28 08:35:26 -05:00
cd $sourcePath/php/php-5.6.36 && ./configure \
--prefix=$serverPath/php/56 \
--exec-prefix=$serverPath/php/56 \
--with-config-file-path=$serverPath/php/56/etc \
--with-zlib-dir=$serverPath/lib/zlib \
2019-01-17 23:59:20 -05:00
--with-mysql=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysqli=mysqlnd \
2018-11-28 08:35:26 -05:00
--enable-zip \
--enable-mbstring \
2019-03-13 01:09:37 -04:00
--enable-simplexml \
2019-03-11 01:43:04 -04:00
--enable-intl \
2018-11-28 08:35:26 -05:00
--enable-ftp \
2019-03-11 01:43:04 -04:00
--enable-sockets \
2019-01-17 10:30:25 -05:00
--enable-pcntl \
--enable-shmop \
2019-01-17 10:16:45 -05:00
--enable-intl \
2018-11-28 08:35:26 -05:00
--enable-wddx \
--enable-soap \
--enable-posix \
2019-03-13 00:38:03 -04:00
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
$OPTIONS \
2018-11-28 08:35:26 -05:00
--enable-fpm \
2019-01-18 00:17:20 -05:00
&& make clean && make && make install && make clean
2018-11-28 08:35:26 -05:00
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
2019-03-12 04:28:48 -04:00
$serverPath/php/init.d/php56 stop
2019-01-17 22:29:32 -05:00
rm -rf $serverPath/php/56
2018-11-28 08:35:26 -05:00
echo "卸载php-5.6.36 ..." > $install_tmp
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi