joelwat Posted March 25, 2008 Share Posted March 25, 2008 CentOS 5.1 PHP 5.2.5 Apache 2.2.8 Smarty 2.6.19 Xdebug 2.0.2 Hi. I'm having a problem with my session data being loaded. When users login to my site, I load there information into the session variable $_SESSION. The problem is that while navigating around the site, randomly you will suddenly be logged off. I've been using Xdebug to try to see what's going on. I have session_start() at the beginning of every page. Usually after the session is started, $_SESSION is loaded correctly with the previous session data. But sometimes after the session is started, $_SESSION is completely empty. Then if I reload the page or go to another page the data will be properly loaded. I checked the id that's stored in a cookie and it is always the same. I have no clue what's causing this problem ??? Any help would be greatly appreciated. Thanks! Joel [session] session.save_handler = files session.save_path = "/var/lib/php/session" session.use_cookies = 1 session.name = mcd session.auto_start = 0 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.cookie_httponly = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 1000 session.gc_maxlifetime = 1440 session.bug_compat_42 = 0 session.bug_compat_warn = 1 session.referer_check = session.entropy_length = 16 session.entropy_file = /dev/urandom session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 session.hash_function = 1 session.hash_bits_per_character = 5 Quote Link to comment https://forums.phpfreaks.com/topic/97741-session-data-not-always-loaded/ Share on other sites More sharing options...
wildteen88 Posted March 25, 2008 Share Posted March 25, 2008 You must have some kinda bug in your code which causes this. Try setting error_reporting to E_ALL and enabling display_errors within the php.ini Your session settings are fine, they should not need to be modified. Quote Link to comment https://forums.phpfreaks.com/topic/97741-session-data-not-always-loaded/#findComment-500219 Share on other sites More sharing options...
xtrafile Posted March 25, 2008 Share Posted March 25, 2008 Your sessions have an "unlimited" lifetime, so your script is killing the session somewhere likely. Look for session_stop or similar that kills the variables at some point. Quote Link to comment https://forums.phpfreaks.com/topic/97741-session-data-not-always-loaded/#findComment-500252 Share on other sites More sharing options...
revraz Posted March 25, 2008 Share Posted March 25, 2008 Make sure you are not changing domains, ie www.mysite.com and mysite.com will use two different sessions. Quote Link to comment https://forums.phpfreaks.com/topic/97741-session-data-not-always-loaded/#findComment-500316 Share on other sites More sharing options...
joelwat Posted March 26, 2008 Author Share Posted March 26, 2008 Thanks for the help! I removed one session setting just before making this post, session.cookie_secure. It seems my sessions are working correctly now, but I'm not sure why that setting would cause that problem. Anyway, thanks again! Quote Link to comment https://forums.phpfreaks.com/topic/97741-session-data-not-always-loaded/#findComment-500909 Share on other sites More sharing options...
joelwat Posted March 26, 2008 Author Share Posted March 26, 2008 Never mind. It still seems to be happening :-\ It seems to be rather random. I'm not using session_stop anywhere and I only use session_destroy for logging out. I'm also not changing domains but I am going between http and https. I'll continue to hunt for bugs in my script but I'm pretty much stumped ??? Quote Link to comment https://forums.phpfreaks.com/topic/97741-session-data-not-always-loaded/#findComment-500934 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.