View Full Version : Session not being remembered
03-19-2007, 12:40 AM
I'm finding that sessions get deleted after the browser is closed (or after some time), despite using:
Any ideas why?
This is in the latest version of Firefox.
03-19-2007, 01:09 AM
Assuming that sessions are functioning using cookies to store the session ID (session_start is actually creating/restarting a session and you can browse between pages and access session variables) there are two things (three if you count code that deliberately destroys a session) that can cause a session to be deleted. The session cookie lifetime (which the code you posted should be taking care of) and session data garbage collection.
Have you determined that the session cookie exists in the cookie folder after the browser is closed?
If your web server is busy or you are on a busy shared hosting web server and/or someone has set a small garbage collection max life time (you won't believe how many times I have seen posts where someone wants to use a short garbage collection time to log people out instead of using proper code), you will see any session data files that are older than session.gc_maxlifetime being deleted every session.gc_probability/session.gc_divisor session_start() statements.
03-19-2007, 01:17 AM
I have no idea why. What have you done to debug?
When it comes to cookies I find the LiveHTTPHeaders (http://livehttpheaders.mozdev.org/) extension for Firefox invaluable. Have you tried that? You should be able to clearly see the cookie parameters being sent via the HTTP header.
Also I use the Web Developer Extension (http://chrispederick.com/work/webdeveloper/) for Firefox. This provides a better interface for viewing/deleting cookies.
Context: CFMaBiSmAd posted while I was writing this.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.