diff --git a/plugins/php-apt/install.sh b/plugins/php-apt/install.sh index d7866f19b..d0e810a6a 100755 --- a/plugins/php-apt/install.sh +++ b/plugins/php-apt/install.sh @@ -110,6 +110,7 @@ if [ "${action}" == "install" ] && [ -d ${serverPath}/php-apt/${type} ];then cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install mbstring cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install zip cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install mongodb + cd ${rootPath}/plugins/php-apt/versions && bash common.sh ${apt_ver} install opcache echo "install PHP-APT[${type}] extend end" if [ ! -f /usr/local/bin/composer ];then diff --git a/plugins/php-apt/versions/common.sh b/plugins/php-apt/versions/common.sh index dee70f882..42e859fb4 100644 --- a/plugins/php-apt/versions/common.sh +++ b/plugins/php-apt/versions/common.sh @@ -28,9 +28,6 @@ FILE=${curPath}/${version}/${extName}.sh FILE_COMMON=${curPath}/common/${extName}.sh # apt install -y php81-php-yar - - - if [ "$action" == 'install' ];then if [ -f $FILE ];then @@ -42,7 +39,6 @@ if [ "$action" == 'install' ];then fi fi - # apt remove -y php81-php-yar if [ "$action" == 'uninstall' ];then if [ -f $FILE ];then @@ -59,6 +55,6 @@ echo "apt remove -y php${version}-${extName}" php_status=`systemctl status php${version}-fpm | grep inactive` echo "status:$php_status" -if [ "$php_status" != "" ];then +if [ "$php_status" == "" ];then systemctl restart php${version}-fpm fi \ No newline at end of file diff --git a/plugins/php-apt/versions/common/opcache.sh b/plugins/php-apt/versions/common/opcache.sh index 28131a477..b73b83b57 100755 --- a/plugins/php-apt/versions/common/opcache.sh +++ b/plugins/php-apt/versions/common/opcache.sh @@ -16,9 +16,40 @@ version=$2 sysName=`uname` LIBNAME=opcache +ext_dir=/etc/php/${version}/fpm/conf.d +ext_file=${ext_dir}/10-opcache.ini + +echo $ext_file + +OP_BL=${serverPath}/server/php-apt/opcache-blacklist.txt +if [ ! -f $OP_BL ];then + touch $OP_BL +fi + if [ "$actionType" == 'install' ];then apt install -y php${version}-${LIBNAME} + + echo "ls ${ext_dir} | grep "${LIBNAME}.ini"| cut -d \ -f 1" + find_opcache=`ls ${ext_dir} | grep "${LIBNAME}.ini"| cut -d \ -f 1` + echo $find_opcache + if [ "$find_opcache" != "" ];then + ext_file=${ext_dir}/${find_opcache} + fi + echo $ext_file + echo "zend_extension=${LIBNAME}.so" >> $ext_file + echo "opcache.enable=1" >> $ext_file + echo "opcache.memory_consumption=128" >> $ext_file + echo "opcache.interned_strings_buffer=8" >> $ext_file + echo "opcache.max_accelerated_files=4000" >> $ext_file + echo "opcache.revalidate_freq=60" >> $ext_file + echo "opcache.fast_shutdown=1" >> $ext_file + echo "opcache.enable_cli=1" >> $ext_file + echo "opcache.jit=1205" >> $ext_file + echo "opcache.jit_buffer_size=64M" >> $ext_file + echo "opcache.save_comments=0" >> $ext_file + echo "opcache.blacklist_filename=${OP_BL}" >> $ext_file + elif [ "$actionType" == 'uninstall' ];then - echo 'cannot uninstall'>&2 - exit 1 + rm -rf $ext_file + echo 'cannot uninstall' fi \ No newline at end of file diff --git a/plugins/php-yum/install.sh b/plugins/php-yum/install.sh index 466713052..2da5e9e4d 100755 --- a/plugins/php-yum/install.sh +++ b/plugins/php-yum/install.sh @@ -31,10 +31,11 @@ if [ ! -d $curPath/versions/$2 ];then exit 0 fi +# cd /www/server/mdserver-web/plugins/php-yum/versions && bash common.sh 83 install opcache #获取信息和版本 -# bash /www/server/mdsever-web/scripts/getos.sh +# bash /www/server/mdserver-web/scripts/getos.sh bash ${rootPath}/scripts/getos.sh OSNAME=`cat ${rootPath}/data/osname.pl` VERSION_ID=`cat /etc/*-release | grep VERSION_ID | awk -F = '{print $2}' | awk -F "\"" '{print $2}'` diff --git a/plugins/php-yum/versions/common.sh b/plugins/php-yum/versions/common.sh index d69af2774..0ef2dc4cd 100644 --- a/plugins/php-yum/versions/common.sh +++ b/plugins/php-yum/versions/common.sh @@ -19,7 +19,7 @@ extName=$3 # echo $serverPath FILE=${curPath}/${version}/${extName}.sh - +FILE_COMMON=${curPath}/common/${extName}.sh # yum install -y php81-php-yar # yum install -y php74-php-pecl-mysql @@ -28,8 +28,10 @@ if [ "$action" == 'install' ];then if [ -f $FILE ];then bash ${curPath}/${version}/${extName}.sh install + elif [ -f $FILE_COMMON ];then + bash ${FILE_COMMON} install ${version} else - yum install -y php${version}-php*-${extName} + yum install -y php${version}-php-${extName} fi # if [ "${extName}" == "mysql" ];then @@ -37,21 +39,28 @@ if [ "$action" == 'install' ];then # fi fi - # yum remove -y php81-php-yar if [ "$action" == 'uninstall' ];then if [ -f $FILE ];then bash ${curPath}/${version}/${extName}.sh uninstall + elif [ -f $FILE_COMMON ];then + bash ${FILE_COMMON} uninstall ${version} else - yum remove -y php${version}-php*-${extName} + yum remove -y php${version}-php-${extName} fi fi echo "yum install -y php${version}-php-${extName}" echo "yum remove -y php${version}-php-${extName}" -bash ${rootPath}/plugins/php-yum/versions/lib.sh $version restart + +echo "systemctl restart php${version}-php-fpm" +php_status=`systemctl status php${version}-php-fpm | grep inactive` +echo "php_status:${php_status}" +if [ "$php_status" == "" ];then + systemctl restart php${version}-php-fpm +fi diff --git a/plugins/php-yum/versions/common/ioncube.sh b/plugins/php-yum/versions/common/ioncube.sh new file mode 100755 index 000000000..0eea4912a --- /dev/null +++ b/plugins/php-yum/versions/common/ioncube.sh @@ -0,0 +1,93 @@ +#!/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=ioncube +LIBV=0 + +if [ `echo "$version > 82"|bc` -eq 1 ];then + echo "I won't support it" + exit 0 +fi + +SORT_LIBNAME="10-${LIBNAME}" +extVer=`bash $curPath/lib.sh $version` +extFile=/opt/remi/php${version}/root/usr/lib64/php +extSoFile=$extFile/modules/${LIBNAME}.so +cfgDir=/etc/opt/remi/php${version}/php.d +extIni=${cfgDir}/10-${LIBNAME}.ini + +echo $extSoFile +echo $extIni + +if [ "$sysName" == "Darwin" ];then + BAK='_bak' +else + BAK='' +fi + + +min_ver=${version:0:1}.${version:1:2} + +Install_lib() +{ + + if [ ! -f "$extFile" ];then + + php_lib=$sourcePath/php_lib + mkdir -p $php_lib + if [ ! -f $php_lib/ioncube_loaders_lin.tar.gz ];then + wget -O $php_lib/ioncube_loaders_lin.tar.gz https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz + cd $php_lib && tar -zxvf ioncube_loaders_lin.tar.gz + fi + cd $php_lib/ioncube + + cp -rf $php_lib/ioncube/ioncube_loader_lin_${min_ver}.so $extSoFile + + fi + + echo "$extSoFile checking ..." + if [ ! -f "$extSoFile" ];then + echo "ERROR!" + return; + fi + + echo "" >> $extIni + echo "[${LIBNAME}]" >> $extIni + echo "zend_extension=${LIBNAME}.so" >> $extIni + + systemctl restart php${version}-fpm + echo '===========================================================' + echo 'successful!' +} + + +Uninstall_lib() +{ + + if [ -f $extIni ];then + rm -rf $extIni + fi + + echo '===============================================' + echo 'successful!' +} + + +if [ "$actionType" == 'install' ];then + Install_lib +elif [ "$actionType" == 'uninstall' ];then + Uninstall_lib +fi \ No newline at end of file diff --git a/plugins/php-yum/versions/common/opcache.sh b/plugins/php-yum/versions/common/opcache.sh new file mode 100755 index 000000000..873253b79 --- /dev/null +++ b/plugins/php-yum/versions/common/opcache.sh @@ -0,0 +1,60 @@ +#!/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=opcache + +cfgDir=/etc/opt/remi + +OP_BL=${serverPath}/server/php-yum/opcache-blacklist.txt +if [ ! -f $OP_BL ];then + touch $OP_BL +fi +ext_dir=${cfgDir}/php${version}/php.d +ext_file=${ext_dir}/10-opcache.ini + +echo $ext_file + +if [ "$actionType" == 'install' ];then + yum install -y php${version}-php-${LIBNAME} + echo "ls ${cfgDir}/php${version}/php.d | grep "${LIBNAME}.ini"| cut -d \ -f 1" + find_opcache=`ls ${cfgDir}/php${version}/php.d | grep "${LIBNAME}.ini"| cut -d \ -f 1` + echo $find_opcache + if [ "$find_opcache" != "" ];then + ext_file=${ext_dir}/${find_opcache} + fi + echo $ext_file + echo "zend_extension=${LIBNAME}" >> $ext_file + echo "opcache.enable=1" >> $ext_file + echo "opcache.memory_consumption=128" >> $ext_file + echo "opcache.interned_strings_buffer=8" >> $ext_file + echo "opcache.max_accelerated_files=4000" >> $ext_file + echo "opcache.revalidate_freq=60" >> $ext_file + echo "opcache.fast_shutdown=1" >> $ext_file + echo "opcache.enable_cli=1" >> $ext_file + echo "opcache.jit=1205" >> $ext_file + echo "opcache.jit_buffer_size=64M" >> $ext_file + echo "opcache.save_comments=0" >> $ext_file + echo "opcache.blacklist_filename=${OP_BL}" >> $ext_file +elif [ "$actionType" == 'uninstall' ];then + if [ -f ${ext_dir}/10-opcache.ini.rpmsave ];then + ext_file=${ext_dir}/10-opcache.ini.rpmsave + fi + + # yum remove -y php83-php-opcache + yum remove -y php${version}-php-${LIBNAME} + rm -rf $ext_file + echo 'cannot uninstall' +fi \ No newline at end of file diff --git a/plugins/php-yum/versions/phplib.conf b/plugins/php-yum/versions/phplib.conf index f61d1cad1..d943f70fa 100755 --- a/plugins/php-yum/versions/phplib.conf +++ b/plugins/php-yum/versions/phplib.conf @@ -103,7 +103,10 @@ "71", "72", "73", - "74" + "74", + "80", + "81", + "82" ], "type": "脚本解密", "msg": "用于解密ionCube Encoder加密脚本!", diff --git a/route/static/app/files.js b/route/static/app/files.js index 34bc293fa..5fad6c602 100755 --- a/route/static/app/files.js +++ b/route/static/app/files.js @@ -290,7 +290,7 @@ function openFilename(obj){ var ext = getSuffixName(path); // console.log(path,ext); - if (inArray(ext,['html','htm','php','txt','md','js','css','scss','json','c','h','pl','py','java','log','conf','sh','json'])){ + if (inArray(ext,['html','htm','php','txt','md','js','css','scss','json','c','h','pl','py','java','log','conf','sh','json','ini'])){ onlineEditFile(0, path); } diff --git a/scripts/update/debian.sh b/scripts/update/debian.sh index 1e454cbe4..eb6d9b8de 100644 --- a/scripts/update/debian.sh +++ b/scripts/update/debian.sh @@ -4,6 +4,9 @@ export PATH export DEBIAN_FRONTEND=noninteractive apt install -y locate +if [ ! -d /usr/share/locale/locale.alias ];then + mkdir -p /usr/share/locale/locale.alias +fi locale-gen en_US.UTF-8 localedef -v -c -i en_US -f UTF-8 en_US.UTF-8 > /dev/null 2>&1 export LC_CTYPE=en_US.UTF-8