Page 1 of 1

PHP session expires much quicker than 180 minutes

Posted: Thu Sep 22, 2005 1:30 pm
by gokusandwich
hello,

i recently started using PHP's sessions. i am finding that the sessions seem to "expire" after 20 or 30 minutes -- or, at least the variables which i set, within $_SESSION, are getting cleared after this relatively short amount of time.

before calling session_start(), i do a few initializations:

ini_set('session.use_cookies', 1);
ini_set('session.use_trans_sid', 0);
ini_set('session.save_handler', 'files');
ini_set('session.serialize_handler', 'php');
ini_set('session.name', 'session-id');

i am not setting the 'session.cache_expire' INI variable, and even did a check to make sure it was not being modified, and i found that it contains the default value of 180 (minutes).

furthermore, the *cookie* is not expiring. i've also checked 'session.cookie_lifetime', and it is 0 (zero, for "until browser is closed"). i've also checked the browser's cookie list, and the cookie is still around at the time that i lose my session variables.

does anyone have any ideas as to why i may be losing my session variables so early?


thank you!

Posted: Thu Sep 22, 2005 1:51 pm
by Weirdan
I bet your session expires after 24 minutes :)
Check session.gc_maxlifetime ini setting, it defaults to 1440 seconds (24 min).