1

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 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

2 Comments

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

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”.

2 Comments

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.