Session expires very quickly in cakePHP 2.9

232 Views Asked by At

I tried many options in config.php file but no success. Here the options. first one:

 Configure::write('Session', array(
    'defaults' => 'php',
            'timeout' => 31556926, // The session will timeout after 30 minutes of inactivity
            'cookieTimeout' => 31556926,
            'ini' => array(
               'session.gc_maxlifetime' => 31556926 // 36 hours
             )
));

second one:

 Configure::write('Session', array(
    'defaults' => 'php',
    'Session.timeout' => 36000
 ));

Please let me know, as session expires in middle of work!

1

There are 1 best solutions below

1
Ajay Krishna Dutta On

use the following code in your (app/Config/core.php)

 Configure::write('Session', array(
        'defaults' => 'cake',
        'timeout' => 30, // The session will timeout after 30 minutes of inactivity
        'cookieTimeout' => 1440, // The session cookie will live for at most 24 hours, this does not effect session timeouts
        'checkAgent' => false,
        'autoRegenerate' => true, // causes the session expiration time to reset on each page load
    ));