calmchess Posted April 27, 2010 Share Posted April 27, 2010 How do i set my sessions to never timeout? Quote Link to comment https://forums.phpfreaks.com/topic/199963-session-forever/ Share on other sites More sharing options...
coupe-r Posted April 27, 2010 Share Posted April 27, 2010 Sessions only timeout when you clear your cache/cookies from your browser, either manually or by a logout script. I believe. Quote Link to comment https://forums.phpfreaks.com/topic/199963-session-forever/#findComment-1049525 Share on other sites More sharing options...
PFMaBiSmAd Posted April 27, 2010 Share Posted April 27, 2010 By default, sessions end when the browser is closed (because the session id cookie has a zero life time) or when session garbage collection removes the corresponding session data file on the server. Sessions are only designed to last for the length of one browser session. Why do you want to make a session last longer because there are probably better solutions available than using a session (forever is a little beyond what is possible anyway, though it is possible to make one last until 19 Jan 2038.) Quote Link to comment https://forums.phpfreaks.com/topic/199963-session-forever/#findComment-1049532 Share on other sites More sharing options...
calmchess Posted April 27, 2010 Author Share Posted April 27, 2010 well i meant for the session to last as long as the browser window is open somehow it expired and i want to prevent that from happening again. Quote Link to comment https://forums.phpfreaks.com/topic/199963-session-forever/#findComment-1049535 Share on other sites More sharing options...
coupe-r Posted April 27, 2010 Share Posted April 27, 2010 Check to make sure your not overwriting that session variable because of the Reg_Globals = ON. Echo your session var on the page to see if it is correct. ETC. Quote Link to comment https://forums.phpfreaks.com/topic/199963-session-forever/#findComment-1049537 Share on other sites More sharing options...
PFMaBiSmAd Posted April 27, 2010 Share Posted April 27, 2010 So are you saying that your code works most of the time but occasionally while someone in on a page and go to a different page or refresh the current page that the session no longer exists? If so, then the most likely cause is - when session garbage collection removes the corresponding session data file on the server. Could you provide a estimate of how much time passes (i.e. 24 minutes) before this occurs and are you on a shared web server? Quote Link to comment https://forums.phpfreaks.com/topic/199963-session-forever/#findComment-1049548 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.