Sessions are ending before MaxLifetime
Sessions are ending before MaxLifetime
Have you ever noticed that your shopping cart does not keep products past closing the browser or they empty out while shopping?
There are two parameters you need to worry about regarding sessions. The first is the TTL for the cookie, the other is how old a session data file can become before it gets garbage collected.
1) session.cookie_lifetime determines, in seconds, how long the cookie sent to the browser will last. It defaults to 0, which means until the browser closes. For two days it'd need to be 172800 seconds. 2) session.gc_maxlifetime determines, also in seconds, how long before session data marked on the server will be regarded as garbage and can be deleted.
Setting the session.cookie_lifetime allows the browser to close and when you go back within the given seconds your products will still be available.
Setting the session.gc_maxlifetime tells php to remove the session after a specific amount of time.