Rémi Becheras
Rémi Becheras

Reputation: 15222

What is the correct way to keep open a user session in cakephp?

I use https to log my users in a CakePHP 2.4.7 application.

According to the documentation, my core.php contains that lines :

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

But my user sessions continue to timeout about each hour. What is wrong, or what I am missing ?

Upvotes: 2

Views: 259

Answers (1)

Rémi Becheras
Rémi Becheras

Reputation: 15222

Thanks to @AD7six:

The problem was in my php.ini configuration :

; 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

Here the time is counted in seconds, not minutes, so, to match the configuration

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

I need :

; 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

Upvotes: 3

Related Questions