Hello, I've been trying to learn how to use PHP sessions but I'm going around in circles. I understand that a session cookie can be given a lifetime ('session.cookie_lifetime') and that after that lifetime the cookie expires regardless of if a user interacts with the site. I would therefore assume to set this to 0 to indicate they should stay live until the browser closes. I also think I understand that the garbage collection lifetime ('session.gc_maxlifetime') can be set for a cookie and that as long as a user does not exceed this time between their clicks then the cookie will remain active.
To test this out I've been trying to get a 10 second session timeout. I tried: ini_set('session.gc_maxlifetime',10); but the session doesn't timeout after 1 minute at least. ...is this because I am only saying to the garbage collector that the session has a life of 10 seconds but I'm not actually triggering the garbage collector? How do you set the garbage collector going or does it just run everytime a session is requested?
Does anyone have some code that can set the lifetime of cookies that works? I can then go away and work out from it how they work. Thanks