pull/123/head
midoks 3 years ago
parent 8c6c54d18c
commit eb114a496a
  1. 29
      plugins/php-apt/versions/common/seaslog.sh
  2. 102
      plugins/php-apt/versions/common/swoole.sh
  3. 15
      plugins/php-apt/versions/common/yaf.sh

@ -4,6 +4,11 @@ export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
@ -12,11 +17,10 @@ LIBNAME=SeasLog
_LIBNAME=$(echo $LIBNAME | tr '[A-Z]' '[a-z]')
sysName=`uname`
LIBNAME=yaf
LIBV=2.2.0
extVer=`bash $curPath/lib.sh $version`
extFile=/usr/lib/php/${extVer}/${LIBNAME}.so
extFile=/usr/lib/php/${extVer}/${_LIBNAME}.so
@ -40,11 +44,11 @@ Install_lib()
php_lib=$sourcePath/php_lib
mkdir -p $php_lib
if [ ! -d $php_lib/${_LIBNAME}-${LIBV} ];then
wget -O $php_lib/${_LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${_LIBNAME}-${LIBV}.tgz
cd $php_lib && tar xvf ${_LIBNAME}-${LIBV}.tgz
if [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz
fi
cd $php_lib/${_LIBNAME}-${LIBV}
cd $php_lib/${LIBNAME}-${LIBV}
/usr/bin/phpize${version}
./configure --with-php-config=/usr/bin/php-config${version}
@ -57,7 +61,7 @@ Install_lib()
return;
fi
_LIBNAME=$(echo $LIBNAME | tr '[A-Z]' '[a-z]')
echo "" >> /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini
echo "[${_LIBNAME}]" >> /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini
echo "extension=${_LIBNAME}.so" >> /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini
@ -74,14 +78,11 @@ Uninstall_lib()
echo "php-$version 未安装,请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
echo "php-$version 未安装${_LIBNAME},请选择其它版本!"
return
fi
rm -rf /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini
rm -rf $extFile
if [ -f /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini ];then
rm -rf /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini
rm -rf $extFile
fi
systemctl restart php${version}-fpm
echo '==============================================='

@ -0,0 +1,102 @@
#!/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")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
sysName=`uname`
LIBNAME=yaf
LIBV=4.8.10
if [ `echo "$version < 7.0"|bc` -eq 1 ];then
LIBV=1.10.1
fi
extVer=`bash $curPath/lib.sh $version`
extFile=/usr/lib/php/${extVer}/${LIBNAME}.so
if [ "$sysName" == "Darwin" ];then
BAK='_bak'
else
BAK=''
fi
Install_lib()
{
#cat /etc/php/${version}/fpm/conf.d/* | grep -v '^;' |tr -s '\n'
isInstall=`cat /etc/php/${version}/fpm/conf.d/* | grep -v '^;' |tr -s '\n' |grep "${LIBNAME}.so"`
if [ "${isInstall}" != "" ];then
echo "php-$version 已安装${LIBNAME},请选择其它版本!"
return
fi
if [ ! -f "$extFile" ];then
php_lib=$sourcePath/php_lib
mkdir -p $php_lib
if [ ! -d $php_lib/${LIBNAME}-${LIBV} ];then
wget -O $php_lib/${LIBNAME}-${LIBV}.tgz http://pecl.php.net/get/${LIBNAME}-${LIBV}.tgz
cd $php_lib && tar xvf ${LIBNAME}-${LIBV}.tgz
fi
cd $php_lib/${LIBNAME}-${LIBV}
/usr/bin/phpize${version}
./configure --with-php-config=/usr/bin/php-config${version}
make && make install && make clean
fi
echo "$extFile checking ..."
if [ ! -f "$extFile" ];then
echo "ERROR!"
return;
fi
echo "" >> /etc/php/${version}/fpm/conf.d/${LIBNAME}.ini
echo "[${LIBNAME}]" >> /etc/php/${version}/fpm/conf.d/${LIBNAME}.ini
echo "extension=${LIBNAME}.so" >> /etc/php/${version}/fpm/conf.d/${LIBNAME}.ini
systemctl restart php${version}-fpm
echo '==========================================================='
echo 'successful!'
}
Uninstall_lib()
{
if [ ! -f "/usr/bin/php-config${version}" ];then
echo "php-$version 未安装,请选择其它版本!"
return
fi
if [ -f /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini ];then
rm -rf /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini
rm -rf $extFile
fi
systemctl restart php${version}-fpm
echo '==============================================='
echo 'successful!'
}
if [ "$actionType" == 'install' ];then
Install_lib
elif [ "$actionType" == 'uninstall' ];then
Uninstall_lib
fi

@ -4,6 +4,11 @@ export PATH
curPath=`pwd`
rootPath=$(dirname "$curPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
rootPath=$(dirname "$rootPath")
serverPath=$(dirname "$rootPath")
sourcePath=${serverPath}/source/php
actionType=$1
version=$2
@ -79,13 +84,11 @@ Uninstall_lib()
return
fi
if [ ! -f "$extFile" ];then
echo "php-$version 未安装${LIBNAME},请选择其它版本!"
return
fi
rm -rf /etc/php/${version}/fpm/conf.d/${LIBNAME}.ini
rm -rf $extFile
if [ -f /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini ];then
rm -rf /etc/php/${version}/fpm/conf.d/${_LIBNAME}.ini
rm -rf $extFile
fi
systemctl restart php${version}-fpm
echo '==============================================='

Loading…
Cancel
Save