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

93 lines
2.3 KiB
Bash
Raw Normal View History

2018-11-27 10:05:01 -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 10:05:01 -05:00
2021-05-08 12:46:02 -04:00
version=7.2.31
2019-11-30 05:28:34 -05:00
PHP_VER=72
2018-11-27 10:05:01 -05:00
Install_php()
{
#------------------------ install start ------------------------------------#
2019-03-07 22:39:22 -05:00
echo "安装php-${version} ..." > $install_tmp
2018-11-27 10:05:01 -05:00
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash libiconv.sh
2022-06-14 14:12:21 -04:00
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
2019-11-30 05:28:34 -05:00
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
2020-07-12 03:10:39 -04:00
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
2021-05-08 12:46:02 -04:00
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
2020-07-12 03:10:39 -04:00
fi
2019-03-07 22:39:22 -05:00
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
2019-11-30 05:28:34 -05:00
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
2018-11-27 10:05:01 -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
2022-07-16 00:50:33 -04:00
OPTIONS='--without-iconv'
# OPTIONS="--with-iconv=${serverPath}/lib/libiconv"
2019-03-13 02:38:02 -04:00
OPTIONS="${OPTIONS} --with-curl"
2019-03-13 00:38:03 -04:00
fi
2022-07-15 21:33:43 -04:00
IS_64BIT=`getconf LONG_BIT`
if [ "$IS_64BIT" == "64" ];then
OPTIONS="${OPTIONS} --with-libdir=lib64"
fi
2022-06-27 05:26:59 -04:00
2019-11-29 10:00:04 -05:00
if [ ! -d $serverPath/php/72 ];then
2019-11-30 05:28:34 -05:00
cd $sourcePath/php/php${PHP_VER} && ./configure \
2019-11-29 10:00:04 -05:00
--prefix=$serverPath/php/72 \
--exec-prefix=$serverPath/php/72 \
--with-config-file-path=$serverPath/php/72/etc \
--with-zlib-dir=$serverPath/lib/zlib \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--enable-zip \
--enable-mbstring \
--enable-simplexml \
--enable-sockets \
--enable-ftp \
--enable-soap \
--enable-posix \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
2022-06-11 23:08:07 -04:00
--disable-intl \
2019-11-29 10:00:04 -05:00
--disable-fileinfo \
$OPTIONS \
2022-06-24 10:22:54 -04:00
--enable-fpm
2022-06-28 10:07:59 -04:00
make clean && make && make install && make clean
2019-11-29 10:00:04 -05:00
fi
2018-11-27 10:05:01 -05:00
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
2019-03-12 04:28:48 -04:00
$serverPath/php/init.d/php72 stop
2018-12-10 03:18:35 -05:00
rm -rf $serverPath/php/72
2019-03-07 22:39:22 -05:00
echo "卸载php-${version}..." > $install_tmp
2018-11-27 10:05:01 -05:00
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi