php - How to set the session timeout in Zend Framework 2 -
i don't have zend experience , want change someone's login code in zend make session not expire.
it seems code basic behavior:
    $adapter = $this->getauthservice()->getadapter();     $adapter->setidentity($email)->setcredential($password);      $result = $this->getauthservice()->authenticate(); what have make session not expire or @ least set session specific time?
right user doesn't stay logged in long, think perhaps relying on default php settings behavior standard 24 minutes gc_maxlifetime.
what connection between zend_session , authservice?
i think need extending session cookie lifetime. use rememberme() function. after authenticating user :
zend_session::rememberme(1209600); //1209600/3600 = 336 hours => 336/24 = 14 days but extending session cookie lifetime not have effect because server not recognize cookie after gc_maxlifetime time elapsed. 
to deal this, must ensure php session.gc_maxlifetime setting @ least same value value passed rememberme().
i don't know if it's practice or not can increase php session garbage collection time. 
in bootstrap.php file, can :
protected function __initsession() { ini_set('session.gc_maxlifetime', 1209600);  // maxlifetime = 14 days ini_set('session.gc_divisor', 1); zend_session::start(); } or in .htaccess file : (for 14 days)
php_value session.gc_maxlifetime 1209600 hope helps.
Comments
Post a Comment