本文介绍了基于Debian的系统在特殊的cron30分钟打死会议,如何覆盖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

已经拉出我的头发试图找出为什么我会被终止/杀害/ 30分钟时被破坏。那么它看起来像基于Debian的系统有一个特殊的cron运行的忽略所有的php.ini和apache的配置和在30分钟时杀死任何空闲会话。

Have been pulling out my hair trying to find out why my sessions are being terminated/killed/destroyed at 30 minutes. Well it looks like Debian based systems have a special cron running that ignores all php.ini and apache configurations and kills any idle session at 30 minutes.

这个cron路径: /etc/cron.d/php5

在cron的:

# /etc/cron.d/php5: crontab fragment for php5
#  This purges session files older than X, where X is defined in seconds
#  as the largest value of session.gc_maxlifetime from all your php.ini
#  files, or 24 minutes if not defined.  See /usr/lib/php5/maxlifetime

# Look for and purge old sessions every 30 minutes
09,39 *     * * *     root   [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm

我不是在配置和设置主机坏,但我不是系统管理员。可能有人请帮助我重写/编辑/变更/重新配置这个,所以我可以设置的值长?我认为3小时将是不错,但我想明白的变化,所以如果有人上涨想让会话时间短/长我CON文件如何配置变化。

I'm not bad at configuring and setting up hosts but I'm no sysAdmin. Could someone please help me override/edit/change/reconfigure this so I can set the value longer? I think 3 hours would be nice but I would like to understand the changes so if someone higher up wants to make the session time shorter/longer I con document how to configure the change.

由于有这方面的洞察力帮助

Thanks to any insight help on this

编辑:
添加/ usr / lib目录/ PHP5 / maxlifetime code

Adding /usr/lib/php5/maxlifetime code

#!/bin/sh -e

max=1440

for ini in /etc/php5/*/php.ini; do
        cur=$(sed -n -e 's/^[[:space:]]*session.gc_maxlifetime[[:space:]]*=[[:space:]]*\([0-9]\+\).*$/\1/p' $ini 2>/dev/null || true);
        [ -z "$cur" ] && cur=0
        [ "$cur" -gt "$max" ] && max=$cur
done

echo $(($max/60))

exit 0

所以它看起来是搜索所有在php.ini文件,找到最大的价值,把它比作1440(即24分钟)。

so it looks to be searching all the php.ini files, finds the greatest value, compares it to 1440 (which is 24 minutes).

下面是在php.ini文件

Here are the php.ini files

/etc/php5/apache2/php.ini
session.gc_maxlifetime = 1440

/etc/php5/cgi/php.ini
session.gc_maxlifetime = 1440

/etc/php5/cli/php.ini
session.gc_maxlifetime = 1440

但为什么我的脚本会得到时30分死亡,不是24分钟呢?

but why does my script session get killed at 30 minutes and not 24 minutes?

编辑#2:
科雷运行,每30分钟就是为什么看上去会以30分钟的间隔被杀害。
但它也可以是24至54分钟,供参考

EDIT #2:CRON running every 30 minutes is why the session looks to be killed at 30 minute intervals.But it could also be 24 to 54 minutes, FYI

也期待在code在: / usr / lib目录/ PHP5 / maxlifetime 它采取的最高值,并在我的测试中,我试图降低门槛加快条件

Also looking over the code in: /usr/lib/php5/maxlifetime it's taking the highest value and during my testing I was trying to lower the threshold to speed up the condition.

看起来像我只需要增加一上的php.ini文件到一个多小时的测试试验。

Looks like I just need to increase one on the php.ini files to over one hour test test.

推荐答案

编辑文件 / usr / lib目录/ PHP5 / maxlifetime

的值应在几秒钟。这个文件实际上还会检查你的php.ini,所以我不知道为什么它不为你工作。

The value should be in seconds. This file will actually also check your php.ini so I don't know why it wasn't working for you.

这篇关于基于Debian的系统在特殊的cron30分钟打死会议,如何覆盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 22:01