Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
September 4, 2006, 2:14 pm
rate this thread
I am currently putting together a shopping cart where items in the
shopping cart (database table) are identified by a session variable -
Im finding that the session variable expires maybe after about 30
minutes (I havent timed it exactly). Whats happening is that the cart
is "forgetting" the items previously put in it or more exact is
creating a new session id and assigning the user and any new items to
Is it possible to set the session variables to expire when the user
shuts down their browser and not after a certain time (eg. 30 minutes)?
How is this done? Do I define this in my PHP script or should I request
this from my hosting company? I do have a hosting account control
panel, is this the sort of thing I would set there typically?
Re: How long do session variables last and how do I change this?
The default value is actually 24 minutes (1440 seconds).
It is determined by the session.gc_maxlifetime setting in php.ini.
As far as I know you can also set it from your scripts using ini_set:
ini_set('session.gc_maxlifetime', 3600); // set timeout to an hour