View Full Version : Session expiring prematurely

11-08-2006, 02:05 AM
I was under the impression a session cookie expires when the browser closes and not a moment sooner. However my application's session cookie seems to pick fairly random times to decide to expire and disappear, requiring my users to login again. I haven't been able to narrow down the cause, whether it be a certain period of inactivity by the user, or a time of day, or what. It happens with IE6 and Firefox 1.5

Any suggestions to force the session cookie to not expire?

11-08-2006, 02:41 AM
session.cookie_lifetime in the php.ini defaults to '0' (until browser closes) but your host may have a different setting , you can alter the session cookie lifetime via .. session_set_cookie_params() (http://www.php.net/manual/en/function.session-set-cookie-params.php)

11-08-2006, 03:33 AM
See this thread for why your sessions are probably being deleted on the server side (garbage collection running) - http://www.codingforums.com/showthread.php?t=99224

11-08-2006, 04:00 AM
Good info, thanks! I'll see if I can improve things.