Page 1 of 1

Expiration of session variables?

Posted: Wed Mar 23, 2005 10:36 am
by spacebiscuit
Hi,

How long do session variables last for.

The reason I ask is because if I return to my sript that uses them they are still active even though I haven't called the script for a few hours.Do they expire after a period or is it necessary to kill them?

I thought to perhaps use a 'log-off' button to kill the session variables, is this necessary?

Is this a concern for the server's memory?

Thanks,

Rob.

Posted: Wed Mar 23, 2005 10:44 am
by feyd
they stick around in the browser until you close all instances of the browser (typically). Depending on server settings, and where you store the session data, the actual data behind the session may be destroyed after a time. But that depends on your settings.

Posted: Wed Mar 23, 2005 10:45 am
by John Cartwright
I do know that sessions expire after a certain period of time if there is no activity.
I do not know how long though however.

Posted: Wed Mar 23, 2005 11:47 am
by php_wiz_kid
A session by default is set to 180 minutes. Youc can change this in your php.ini file or you can use the session_cache_expire() function to set the sessions expiration time. Check out the PHP docs for more info. I hope this helps.