I have problem for set a timeout on Zend_Auth Session this is my code :
$authSession = new Zend_Session_Namespace('Zend_Auth');
$authSession->setExpirationSeconds(60*60*24*1);
This code should make session expire after 1 day but actualy session expire after about 30 min. Anyone know what's wrong ? Thank you.
The default session.gc_maxlifetime value in
php.ini
which specifies the number of seconds after which session data will be seen as 'garbage' is 24 minutes.Calling
Zend_Session_Namespace::setExpirationSeconds()
is an internal to Zend Framework and has no effect on the session cookie itself or the session data on the server.Make sure to adjust your
session.gc_maxlifetime
value accordingly such that PHP won't delete the data before you want it to. You can set this directly inphp.ini
or you can useini_set
somewhere in your bootstrap, or from your ZFapplication.ini
file, use something likeresources.session.gc_maxlifetime = 864000
See also:
Paragraph 2 of persisted login with Zend_Session::rememberMe
How do I create persistent sessions in PHP?
Paragraph 4 of Zend Framework Automatic Logout after inactivity