I am trying to set the max life time of a session with the \Zend\Session\Container
. To test it I put it to 1 sec.
Now I looked at the docs
So i did
$config = new StandardConfig();
$config->setOptions(array(
'remember_me_seconds' => 1,
));
$manager = new SessionManager($config);
$session = new Container('user', $manager);
But no success. Then I started googling and found this answer
So I made the config to
return array(
'session' => array(
'remember_me_seconds' => 2419200,
'use_cookies' => true,
'cookie_httponly' => true,
),
);
(the config worked and was loaded into the manager) but again no success
So I continued searching and found this answer
But again no success.
So after all the searching I couldn't get it working, so now I hope some one else got it working and can help me.
In application global.php or you can do it in module config:
check Zend\Session\Service\SessionConfig.
Change the value of
2419200
to how many seconds you actually want.Well I finaly found out what the issue was.
The problem was that I used
This "worked" the only issue was that there was set a cookie with the lifetime
session
. This ment different things in browsers. Ie in chrome it is destroyed if you close the tab, so no matter how high thegc_maxlifetime
it would not work.So an easy fix would be the following
Hope it would help some one in the futue
$config['authTimeout']
is a positive integer value