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-yum/versions/common/opcache.sh

54 lines
1.6 KiB

11 months 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")
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
11 months ago
OP_BL=${serverPath}/server/php-yum/opcache-blacklist.txt
11 months ago
if [ ! -f $OP_BL ];then
touch $OP_BL
fi
ext_dir=${cfgDir}/php${version}/php.d
ext_file=${ext_dir}/10-opcache.ini
11 months ago
if [ "$actionType" == 'install' ];then
11 months ago
yum install -y php${version}-php-${LIBNAME}
11 months ago
echo "ls ${cfgDir}/php${version}/php.d | grep "${LIBNAME}"| cut -d \ -f 1"
11 months ago
find_opcache=`ls ${cfgDir}/php${version}/php.d | grep "${LIBNAME}"| cut -d \ -f 1`
11 months ago
echo $find_opcache
if [ "$find_opcache" != "" ];then
ext_file=${find_opcache}
11 months ago
fi
11 months ago
echo $ext_file
11 months ago
echo "zend_extension=${LIBNAME}" >> $ext_file
11 months ago
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
11 months ago
elif [ "$actionType" == 'uninstall' ];then
11 months ago
yum remove -y php${version}-php-${LIBNAME}
11 months ago
rm -rf $ext_file
11 months ago
echo 'cannot uninstall'
exit 1
fi