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

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -