How to Manage PHP Session Variables That Disappear When The User Is Inactive For a While

I set some PHP session variables when my user logs into my app.

Generally they work very well.

However if the user leaves their computer for a few hours, when they come back, the app is still running in the browser but the PHP session variables are no longer present, so the app randomly fails tasks that rely on them.

Not being a PHP guru, can anyone explain exactly what is going on here and the best way to manage this situation?

Thanks!
Antony.

Session storage lengths are set in the php.ini file for the respective PHP version Antony. You can change this value by increasing the amount of seconds sessions are stored for by editing the following line (this value is in seconds):

session.gc_maxlifetime = 10000

Brilliant, thank you @Dave!

No worries sir! :wink:

write a cookie instead? you can set it to a month or whatever you want.

But this is server side… and cookies are client side!

Too many things called “sessions”! :exploding_head: