mdserver-web/plugins/php/versions/53/eaccelerator.sh

109 lines
2.9 KiB
Bash
Raw Permalink Normal View History

2019-03-08 04:11:20 -05:00
#!/bin/bash
2023-11-08 12:32:59 -05:00
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
2019-03-08 04:11:20 -05:00
export PATH
2019-03-08 05:52:37 -05:00
# php 5.2.17 + eaccelerator 0.9.5.3
# php 5.3.24 + eaccelerator 0.9.6.1
# php 5.4.14 + eaccelerator 1.0 dev
2019-03-08 04:11:20 -05:00
2019-03-08 05:52:37 -05:00
curPath=`pwd`
2019-03-08 04:11:20 -05:00
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
2023-08-13 02:13:32 -04:00
SYS_ARCH=`arch`
2019-03-08 04:11:20 -05:00
LIBNAME=eaccelerator
LIBV=0.9.6
sysName=`uname`
actionType=$1
version=$2
2021-12-03 03:54:44 -05:00
NON_ZTS_FILENAME=`ls $serverPath/php/${version}/lib/php/extensions | grep no-debug-non-zts`
extFile=$serverPath/php/${version}/lib/php/extensions/${NON_ZTS_FILENAME}/${LIBNAME}.so
2019-03-08 04:11:20 -05:00
2020-07-11 11:47:58 -04:00
if [ "$sysName" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
2019-03-08 04:11:20 -05:00
Install_lib()
{
isInstall=`cat $serverPath/php/$version/etc/php.ini|grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
2019-11-30 03:55:45 -05:00
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
2019-03-08 04:11:20 -05:00
return
fi
if [ ! -f "$extFile" ];then
2019-11-29 03:36:09 -05:00
php_lib=$sourcePath/php_lib
2019-03-08 04:11:20 -05:00
mkdir -p $php_lib
2019-11-30 03:55:45 -05:00
if [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then
2020-07-14 01:02:09 -04:00
wget -O $php_lib/${LIBNAME}-${LIBV}.tar.gz https://github.com/eaccelerator/eaccelerator/archive/${LIBV}.tar.gz
2019-11-30 03:55:45 -05:00
# wget -O $php_lib/${LIBNAME}-${LIBV}.tar.bz2 http://dl.wdlinux.cn:5180/soft/eaccelerator-0.9.6.1.tar.bz2
2020-07-14 01:01:35 -04:00
cd $php_lib && tar -zxvf ${LIBNAME}-${LIBV}.tar.gz
2019-11-30 03:55:45 -05:00
fi
cd $php_lib/${LIBNAME}-${LIBV}
2023-08-13 02:13:32 -04:00
OPTIONS=""
if [ "${SYS_ARCH}" == "aarch64" ] && [ "$version" -lt "56" ];then
OPTIONS="$OPTIONS --build=aarch64-unknown-linux-gnu --host=aarch64-unknown-linux-gnu"
fi
2019-03-08 04:11:20 -05:00
$serverPath/php/$version/bin/phpize
2019-03-08 05:52:37 -05:00
./configure --with-php-config=$serverPath/php/$version/bin/php-config \
2023-08-13 02:13:32 -04:00
$OPTIONS \
2019-11-30 03:55:45 -05:00
--enable-eaccelerator=shared
2019-11-29 03:36:09 -05:00
make && make install && make clean
2019-03-08 04:11:20 -05:00
fi
if [ ! -f "$extFile" ];then
echo "ERROR!"
return
fi
echo "" >> $serverPath/php/$version/etc/php.ini
echo "[${LIBNAME}]" >> $serverPath/php/$version/etc/php.ini
echo "extension=${LIBNAME}.so" >> $serverPath/php/$version/etc/php.ini
2022-07-03 06:30:45 -04:00
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
2019-03-08 04:11:20 -05:00
echo '==========================================================='
echo 'successful!'
}
Uninstall_lib()
{
if [ ! -f "$serverPath/php/$version/bin/php-config" ];then
echo "php$version 未安装,请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
echo "php$version 未安装${LIBNAME},请选择其它版本!"
echo "php-$vphp not install ${LIBNAME}, Plese select other version!"
return
fi
2020-07-11 11:47:58 -04:00
sed -i $BAK "/${LIBNAME}.so/d" $serverPath/php/$version/etc/php.ini
sed -i $BAK "/${LIBNAME}/d" $serverPath/php/$version/etc/php.ini
2019-03-08 04:11:20 -05:00
rm -f $extFile
2022-07-03 06:30:45 -04:00
bash ${rootPath}/plugins/php/versions/lib.sh $version restart
2019-03-08 04:11:20 -05:00
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi