Jump to content

Session timeout issue


robcrozier

Recommended Posts

Hi.  I'm having an issue with my file uploading script.  Basically, it uses perl to do the actual uploading which means massive files can be uploaded.  This, however causes my PHP session to timeout and log the user out before they have a chance to do anything with their newly uploaded file. 

 

Is there any way that i can make sure that the session does not timeout on this one script?  I want the session timeout to remain at around 20 mins as default, except when the user uploads a file that may take more than 20 mins depending on the size of it.

 

Any suggestions would be great!

 

Thanks in advance

Link to comment
Share on other sites

Won't work.

 

Any session data file that is older than the current session.gc_maxlifetime setting will be deleted when garbage collection runs. As soon as you set it to the shorter value and a session_start() causes garbage collection to run, any session data file older than the current shorter setting will be deleted.

 

Also, on a shared web server when you use the default session save path, the shortest session.gc_maxlifetime setting of all the scripts running on the server wins, so you must also set the session.save_path setting to be to a private folder within your account's storage space so that your session.gc_maxlifetime setting only affects your session data files.

 

A session is just a container that holds variables. You should not rely on the operation of the session or session garbage collection to log anyone out. You should set the session.gc_maxlifetime setting to be as long as you need it and any automatic log out should rely on you storing the last access time for each visitor and then checking if that last access time is greater in the past than a limit you set. If someone is uploading a file, you would simply use a longer limit in your comparison.

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.