tags:

views:

539

answers:

2

My application uses some session variables that are timing out even though I thought they would not because I've got the following setting in php.ini:

session.cookie_lifetime = 0

The other session settings in php.ini are pretty much set as their defaults. How do I make sure the session variables stay around until the browser window closes?

+2  A: 

I think you set the session timeout with session.gc_maxlifetime which defaults to 1440 seconds - 24 minutes

meouw
gc = garbage collect. After 1440 seconds a session which does gc will delete it.
OIS
yup, so after this time the session might have disappeared even if the cookie is still there
meouw
A: 

Note that since PHP 4.2.3 the life time is calculated on the base of the modification date and not the access date (see session.gc_maxlifetime). So you have to update the session data on every request to “reset the timer”.

Gumbo
Is there any hazard to setting a longer value, such as 10800 (3 hours)? I don't THINK disk space is an issue.
I'm considering going as high as 10 hours for gc_maxlifetime. Is the only consideration how much disk space is taken up by the files until they're deleted? Any other complications?