Home >Backend Development >PHP Problem >How to periodically release the memory occupied by PHP through scheduled tasks

How to periodically release the memory occupied by PHP through scheduled tasks

藏色散人
藏色散人forward
2020-12-01 14:07:551980browse

The following tutorial column of Pagoda Panel will introduce to you how to regularly release the memory occupied by PHP through scheduled tasks. I hope it will be helpful to friends in need!

How to periodically release the memory occupied by PHP through scheduled tasks

Release the memory occupied by PHP regularly through scheduled tasks

Add a task in the scheduled task and select the period, such as every Monday 3 Execute at 30 minutes

Select to execute the Shell script and paste the following Shell script

if [ -f /etc/init.d/php-fpm-52 ];then
        service php-fpm-52 reload
fi
if [ -f /etc/init.d/php-fpm-53 ];then
       service php-fpm-53 reload
fi
if [ -f /etc/init.d/php-fpm-54 ];then
       service php-fpm-54 reload
fi
if [ -f /etc/init.d/php-fpm-55 ];then
        service php-fpm-55 reload
fi
if [ -f /etc/init.d/php-fpm-56 ];then
        service php-fpm-56 reload
fi
if [ -f /etc/init.d/php-fpm-70 ];then
      service php-fpm-70 reload
fi
myDate=`date +"%Y-%m-%d %H:%M:$S"`
echo "★[$myDate] PHP内存回收成功!"
echo '------------------------------------------------------------------------------';

The above is the detailed content of How to periodically release the memory occupied by PHP through scheduled tasks. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:bt.cn. If there is any infringement, please contact admin@php.cn delete