Jump to content


This topic is now archived and is closed to further replies.


Strange Session Behavior

Recommended Posts


I am currently experiencing some problems with sessions and I thought someone here might have had the same problem in the past and could point me in the right direction.

I use my session to store a few simple variable values and under normal circumstances the session works fine and I can access my variables as I move from page to page. However, I have my session.cookie_lifetime setting set to zero so that the session should not expire until the browser closes. This all works fine but what I want to do is extend the timeout of inactivity because my sessions were being destroyed after roughly 24 minutes (the default garbage collection lifetime setting I believe). So, I have also temporarily set my garbage collection lifetime value to 10 hours (for testing purposes) and this is where things get strange for me. My session seemed to be timing out after the same period of inactivity even though I used ini_get to double check that the garbage collecxtion max lifetime is set to 10 hours. On closer inspection I discovered that perhaps my session was not expiring but the variables stored in them becoming lost or garbage collected for some reason. You see, when I leave a page for about 30 minutes and then refresh, I am redirected back to my Login screen indicating that the session variable 'LoggedIn' has somehow become unset (as with all my other session variables). However, when I print out the session id, it is still the same as before the period of inactivity. So it seems to me as if the session is still alive but the variables that were registered with it have become lost (either that or a new session was created with the exact same ID which seems unlikely to me).

Any help you guys might have to offer would be greatly appreciated.


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.