Jump to content

session expiring after a couple hours...please help!


mcerveni

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.