Simple Linux Panel
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mdserver-web/plugins/php/versions/73/install.sh

105 lines
2.9 KiB

7 years ago
#!/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
6 years ago
sysName=`uname`
6 years ago
install_tmp=${rootPath}/tmp/mw_install.pl
7 years ago
3 years ago
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function version_le() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" == "$1"; }
function version_lt() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" != "$1"; }
function version_ge() { test "$(echo "$@" | tr " " "\n" | sort -rV | head -n 1)" == "$1"; }
7 years ago
3 years ago
version=7.3.33
6 years ago
PHP_VER=73
7 years ago
Install_php()
{
#------------------------ install start ------------------------------------#
6 years ago
echo "安装php-${version} ..." > $install_tmp
7 years ago
mkdir -p $sourcePath/php
mkdir -p $serverPath/php
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash freetype_old.sh
3 years ago
cd $serverPath/mdserver-web/plugins/php/lib && /bin/bash zlib.sh
6 years ago
if [ ! -d $sourcePath/php/php${PHP_VER} ];then
5 years ago
if [ ! -f $sourcePath/php/php-${version}.tar.xz ];then
4 years ago
wget --no-check-certificate -O $sourcePath/php/php-${version}.tar.xz https://museum.php.net/php7/php-${version}.tar.xz
5 years ago
fi
6 years ago
cd $sourcePath/php && tar -Jxf $sourcePath/php/php-${version}.tar.xz
6 years ago
mv $sourcePath/php/php-${version} $sourcePath/php/php${PHP_VER}
7 years ago
fi
6 years ago
OPTIONS=''
if [ $sysName == 'Darwin' ]; then
OPTIONS='--without-iconv'
6 years ago
OPTIONS="${OPTIONS} --with-curl=${serverPath}/lib/curl"
6 years ago
# OPTIONS="${OPTIONS} --with-libzip=${serverPath}/lib/libzip"
# OPTIONS="${OPTIONS} --enable-zip"
6 years ago
else
3 years ago
OPTIONS='--without-iconv'
6 years ago
OPTIONS="${OPTIONS} --with-curl"
6 years ago
fi
3 years ago
IS_64BIT=`getconf LONG_BIT`
if [ "$IS_64BIT" == "64" ];then
OPTIONS="${OPTIONS} --with-libdir=lib64"
fi
3 years ago
ZIP_OPTION='--enable-zip'
libzip_version=`pkg-config libzip --modversion`
if version_lt "$libzip_version" "0.11.0" ;then
export PKG_CONFIG_PATH=$serverPath/lib/libzip/lib/pkgconfig
ZIP_OPTION="--with-libzip=$serverPath/lib/libzip"
fi
6 years ago
6 years ago
if [ ! -d $serverPath/php/73 ];then
6 years ago
cd $sourcePath/php/php${PHP_VER} && ./configure \
6 years ago
--prefix=$serverPath/php/73 \
--exec-prefix=$serverPath/php/73 \
--with-config-file-path=$serverPath/php/73/etc \
--enable-mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-zlib-dir=$serverPath/lib/zlib \
--enable-ftp \
$ZIP_OPTION\
6 years ago
--enable-sockets \
--enable-simplexml \
3 years ago
--enable-mbstring \
6 years ago
--enable-soap \
--enable-posix \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
3 years ago
--disable-intl \
6 years ago
--disable-fileinfo \
$OPTIONS \
--enable-fpm
3 years ago
make clean && make && make install && make clean
6 years ago
fi
7 years ago
#------------------------ install end ------------------------------------#
}
Uninstall_php()
{
6 years ago
$serverPath/php/init.d/php73 stop
6 years ago
rm -rf $serverPath/php/73
6 years ago
echo "卸载php-${version}..." > $install_tmp
7 years ago
}
action=${1}
if [ "${1}" == 'install' ];then
Install_php
else
Uninstall_php
fi