does anyone knows how to increase the session timeout in cakephp 3, no matter how I tried, it just timeout at 15 min,
the latest thing, I tried is to
change this setting at app.php file, but it still timeout at around 15 min, which is quite fustrating
'Session' => [
'defaults' => 'php',
'timeout'=>300*60//in minutes
],
Thank you
There's session timeout, and there's session cookie lifetime. The latter isn't affected by the former, which is configurable in the CakePHP configuration as shown in your code snippet, and is handled by CakePHPs session handler.
Check your PHP installations session.cookie_lifetime setting, it might be the cause of the issue. If you need to change it, either do that in your php.ini, or use the ini option in the CakePHP session configuration.
Quote from the docs:
By default PHP sets the session cookie to expire as soon as the browser is closed, regardless of the configured Session.timeout value. The cookie timeout is controlled by the session.cookie_lifetime ini value and can be configured using:
Configure::write('Session', [ 'defaults' => 'php', 'ini' => [ // Invalidate the cookie after 30 minutes without visiting // any page on the site. 'session.cookie_lifetime' => 1800 ] ]);The difference between Session.timeout and the session.cookie_lifetime value is that the latter relies on the client telling the truth about the cookie. If you require stricter timeout checking, without relying on what the client reports, you should use Session.timeout.
Cookbook > Sessions > Session Configuration
If that doesn't fix the problem, then you'll have to do some debugging, check the session cookies expiration value, hook into CakePHPs session handler to figure whether this is where the session is being killed (\Cake\Network\Session::_timedOut()), etc...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With