Re: Destroying session if not being used from past 10 mins.
| From: | Binay | Date: | Tue, 21 Oct 2003 12:33:52 +0000 |
| Subject: | Re: Destroying session if not being used from past 10 mins. | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-166946@lists.php.net to get a copy of this message | ||
Thanks alotttttttt.......
Is it possible to increase the probability which is by default 1% to 99 %
and make sure that session are destroyed after 10 mins by setting
session.gc_maxlifetime to 600.
Binay
----- Original Message -----
From: "CPT John W. Holmes" <holmes072000@charter.net>
To: "Binay" <binay@oliveinternet.com>; <php-general@lists.php.net>
Sent: Tuesday, October 21, 2003 5:08 PM
Subject: Re: [PHP] Destroying session if not being used from past 10 mins.
> From: "Binay" <binay@oliveinternet.com>
>
> > How can I configure the session to get destroyed,
> > if not being used from past 10 mins.
>
> If you're using the default session handler, the session files are cleaned
> up after not being used for 1440 seconds (by default), and the session is
> basically destroyed. You can adjust the session.gc_maxlifetime setting in
> php.ini to adjust the time.
>
> This time isn't exact, though. The cleanup process is based upon a
> probability that is 1% by default. That means the process has a 1% chance
of
> being started when there is a request to your site. So the files may be
> older than 1440 seconds and just waiting for the garbage collection
process
> to be initiated.
>
> If you need it to be exactly 10 minutes of inactivity, the best method is
to
> just store the time of the last request as a session variable and do the
> checking yourself upon each request. If the last request was more than 10
> minutes ago, then handle it accordingly.
>
> ---John Holmes...