CakePHP的认证超时问题 [英] Auth timeout problems with CakePHP

查看:142
本文介绍了CakePHP的认证超时问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这真的让我很烦。已经多年了。无论我用core.php或php.ini做什么,我的登录超时大约一个小时 - 通常。一些相同代码和配置的部署在经过可观的时间后超时。

This is really bugging me. Has been for years. No matter what I do with core.php or php.ini, my logins timeout after about an hour - usually. Some deployments of identical code and configuration timeout after a respectable amount of time.

这是我现在在一个网站上 - 大约一个小时后超时: / p>

This is what I have at the moment on one site - timed out after about an hour:

session.gc_divisor  1000
session.gc_maxlifetime  86400
session.gc_probability  1

Configure::write('Session.timeout', '28800');
Configure::write('Session.checkAgent', false);
Configure::write('Security.level', 'medium');

另一种 - 持续整夜:

And another - lasted all night:

session.gc_divisor  100
session.gc_maxlifetime  14400
session.gc_probability  0

Configure::write('Session.timeout', '315360000');
Configure::write('Session.checkAgent', false);
Configure::write('Security.level', 'medium');

现在,在你兴奋之前说,嗯,答案是在Session.timeout价值,让我告诉你,这个网站通常在大约二十分钟后超时!

Now, before you get excited and say, "Well, the answer is there in the Session.timeout value", let me tell you that this site usually times out after about twenty minutes!

推荐答案

,其他应用程序可以通过清除php定义的会话目录来重置会话。 Rowlf在他的回答中提到了这一点。

Somewhere I read that on shared hosting, other applications can reset the session by clearing the php-defined session directory. This was alluded to by Rowlf in his answer.

CakePHP提供了配置会话处理方式的选项。在 core.php 我改变为'cake'(默认是'php '):

CakePHP offers the option to configure the way sessions are handled. In core.php I changed this to 'cake' (by default it is 'php'):

/**
 * The preferred session handling method. Valid values:
 *
 * 'php'            Uses settings defined in your php.ini.
 * 'cake'       Saves session files in CakePHP's /tmp directory.
 * 'database'   Uses CakePHP's database sessions.
 */
Configure::write('Session.save', 'cake');

我还确保会话超时和相应的php.ini值是相同的:

I also ensured that the session timeout and the corresponding php.ini values are the same:

/**
 * Session time out time (in seconds).
 * Actual value depends on 'Security.level' setting.
 */
Configure::write('Session.timeout', '86400');

到目前为止,系统尚未注销。

So far, the system hasn't logged out.

这篇关于CakePHP的认证超时问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆