mcerveni Posted October 11, 2009 Share Posted October 11, 2009 So I have a website that over 80 users access throughout the day. They are logged in for a 9 hour shift. When i first launched the site, after about 3.5 - 4 hours, the session expired and logged them out. Now, after a week of it being used..after an hour the session expires, becomes blank, and the user has to log out again. I have this on the top of my header include file: session_start(); ini_set("session.cookie_lifetime", 86400); i now changed that to: ini_set('session.gc_maxlifetime', 86400); so i hope this will work... any suggestions?? Link to comment https://forums.phpfreaks.com/topic/177274-session-expiring-after-a-couple-hoursplease-help/ Share on other sites More sharing options...
PFMaBiSmAd Posted October 11, 2009 Share Posted October 11, 2009 Setting any of the session settings after the session_start() has no effect. They must be set before the session start and they must be set before every session_start. It is best and simpler to globally set them in the master php.ini (when you have access to it), in a .htaccess file (when php is running as an Apache Module), or in a local php.ini (when php is running as a CGI appliction.) If you are on a shared web server you must also set the session.save_path to be to a private folder within your account's folder tree so that your session data files will only be affected by your session settings. The session.cookie_lifetime only has an effect if the browser is completely closed. If the browser is kept open (even if none of the windows/tabs are a page on your site), it has no effect. Link to comment https://forums.phpfreaks.com/topic/177274-session-expiring-after-a-couple-hoursplease-help/#findComment-934691 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.