mdserver-web/plugins/php-yum/versions/common/opcache.sh

60 lines
1.7 KiB
Bash
Raw Permalink Normal View History

2024-06-14 01:36:37 -04:00
#!/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
2024-06-14 01:49:49 -04:00
OP_BL=${serverPath}/server/php-yum/opcache-blacklist.txt
2024-06-14 01:47:28 -04:00
if [ ! -f $OP_BL ];then
touch $OP_BL
fi
ext_dir=${cfgDir}/php${version}/php.d
ext_file=${ext_dir}/10-opcache.ini
2024-06-14 03:40:26 -04:00
echo $ext_file
2024-06-14 01:36:37 -04:00
if [ "$actionType" == 'install' ];then
2024-06-14 01:59:06 -04:00
yum install -y php${version}-php-${LIBNAME}
2024-06-14 02:56:02 -04:00
echo "ls ${cfgDir}/php${version}/php.d | grep "${LIBNAME}.ini"| cut -d \ -f 1"
2024-06-14 02:58:15 -04:00
find_opcache=`ls ${cfgDir}/php${version}/php.d | grep "${LIBNAME}.ini"| cut -d \ -f 1`
2024-06-14 02:22:32 -04:00
echo $find_opcache
if [ "$find_opcache" != "" ];then
2024-06-14 03:58:13 -04:00
ext_file=${ext_dir}/${find_opcache}
2024-06-14 01:47:28 -04:00
fi
2024-06-14 02:22:32 -04:00
echo $ext_file
2024-06-14 02:26:59 -04:00
echo "zend_extension=${LIBNAME}" >> $ext_file
2024-06-14 02:22:32 -04:00
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
2024-06-14 01:36:37 -04:00
elif [ "$actionType" == 'uninstall' ];then
2024-06-14 04:02:36 -04:00
if [ -f ${ext_dir}/10-opcache.ini.rpmsave ];then
ext_file=${ext_dir}/10-opcache.ini.rpmsave
fi
2024-06-14 04:02:23 -04:00
# yum remove -y php83-php-opcache
2024-06-14 02:48:52 -04:00
yum remove -y php${version}-php-${LIBNAME}
2024-06-14 01:47:28 -04:00
rm -rf $ext_file
2024-06-14 01:36:37 -04:00
echo 'cannot uninstall'
2024-06-14 03:19:43 -04:00
fi