在cakephp中保持用户会话打开的正确方法是什么?

在cakephp中保持用户会话打开的正确方法是什么?,cakephp,session-timeout,Cakephp,Session Timeout,我使用https在CakePHP 2.4.7应用程序中记录我的用户 根据文档,my core.php包含以下行: Configure::write('Session', array( 'defaults' => 'php', 'timeout' => 1440 // 24 hours )); 但是我的用户会话大约每小时都会超时一次。 有什么不对,或者我遗漏了什么?多亏了@AD7six: 问题出在我的php.ini配置中: ; After this number of

我使用https在CakePHP 2.4.7应用程序中记录我的用户

根据文档,my core.php包含以下行:

Configure::write('Session', array(
    'defaults' => 'php',
    'timeout' => 1440 // 24 hours
));
但是我的用户会话大约每小时都会超时一次。 有什么不对,或者我遗漏了什么?

多亏了@AD7six:

问题出在我的php.ini配置中:

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
; http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 1440
在这里,时间是以秒为单位计算的,而不是以分钟为单位,因此,要与配置相匹配

Configure::write('Session', array(
    'defaults' => 'php',
    'timeout' => 1440 // 24 hours
));
我需要:

; After this number of seconds, stored data will be seen as 'garbage' and
; cleaned up by the garbage collection process.
; http://php.net/session.gc-maxlifetime
session.gc_maxlifetime = 86400
; 24 hours: 1440*60

您可以检查您的cookie生存期是否正确,这应该是确定的,但最好是双重检查itcheck session.gc\u maxlifest。如果会话即将过期,那么您需要确定原因(一种方法是将会话文件/存储文件夹设置为只读,并在有人试图删除它时查找错误消息)。另一个典型场景是会话被敲打/失效(击中应用程序的并行404请求可能会导致会话id被更新,从而使会话cookie的id与服务器上的id不同)。或者:它是特定于应用程序/服务器/开发人员的。显然,根据建议,您不太可能得到答案。@Soulan my cookie将在24小时后到期,如配置所示。