Re: Intelligent "session_destroy()"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ken Tozier wrote:
I'm writing a bunch of scripts that will all use a common session and am a bit confused about when to manually destroy sessions and/or when php automatically destroys them for me. For example:

If a user starts a session, leaves their computer on and goes home for the weekend, when they come back on Monday will their session still exist on the server? Could they pick right up where they left off?

don't care and only sets

session.gc_maxlifetime
session.gc_divisor
session.gc_probability

to correct values.

When you call session_start php sometimes runs garbage collector which remove old sessions. Probability is calculated by using gc_probability/gc_divisor e.g. 1/100 means there is a 1% chance that the GC process starts on each session_start(). If you set probability to 100% GC will run on every session_start(). This is good for testing but not for production environment (default value (1%) is enough).

Sessions which is last modified (before php 4.2.? was used last access time) before current time minus gc_maxlifetime is a old session and will be deleted.

--
Ondrej Ivanic
(ondrej@xxxxxxx)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux