I setup my session timeout in CakePHP to be very long due to a business need, I configured it on core.php like this:
Configure::write('Session', array(
'defaults' => 'php',
'timeout' => 4320, //minutes
'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
'ini' => array(
'session.gc_maxlifetime' => 259200 // 3 day seconds
)
));
I make some tests on local server and in production server and I see some differences:
Local development environment (PC)
1 hour: successfull (session not closed)
2 hour: successfull (session not closed)
4 hour: succesfull (session not closed)
Production server
1 hour: successfull (session not closed)
2 hour: Not successfull (session closed)
I need to be able to have big timeouts (4 hours minimum) on the production server, why I have this differences between the local PC and the server?
This is because your web host has different PHP configuration. You can check using phpinfo() about the Session expire time.
You can set it using PHP ini