0

My session.cookie_lifetime is set to 7 days (604800 seconds).

I've run into an issue where sometimes users get logged out in the middle of a long multiple file upload (using PLupload), because they happened to log in (say) 6 days and 23 hours before starting the upload.

I'd like to prevent this happening by somehow refreshing the session on the upload page. My site's sessions are stored in files. Do I have to pull the data out of the current session, kill it, and start a new one with the same data in it? Or is there an actual "way" to do what I want?

Thanks

Codemonkey
  • 4,455
  • 5
  • 44
  • 76
  • PHP already refreshes it – Your Common Sense Jun 15 '22 at 15:46
  • and "logging in" has nothing to do with session timeout – Your Common Sense Jun 15 '22 at 15:47
  • You're very right on your second point, that hadn't occurred to me, and I 100% understand what you mean. Regarding the first point.... is that so? So my issue is something else completely then, that's a shame, I thought I'd fixed this bug – Codemonkey Jun 15 '22 at 15:56
  • "ssession cookie lifetime" is not what causes a PHP server-side session to be garbage-collected. You need to adjust the lifetime of a server-side session record so that it doesn't get deleted by the host. *(And* keep the client-side "lifetime" as it is so that the cookie also doesn't go away.) – Mike Robinson Jun 15 '22 at 15:58
  • Ah yes, I had that and gc_maxlifetime confused. So I think the cookie expiring every 7 days would be the issue then, correct? As even if they've recently loaded a page, and php has refreshed the session, if the cookie expires in the next few minutes then the session effectively ends. – Codemonkey Jun 15 '22 at 16:11
  • So if I keep gc_maxlifetime as 7 days and change cookie_lifetime to 10 years, then they'll hardly ever be logged out against their will, unless they've not visited the site for 7 days, correct? – Codemonkey Jun 15 '22 at 16:12

0 Answers0