At 09:28 22.11.2002, Jean-Christian Imbeault said:
>> This is controlled by the session.gc_probability value in your INI file
>I know I can probably find this in the documentation somewhere but ... 
>how do I set the expire time on a session?

The session.gc_probability value is an overall value that you cannot escape
as to my knowledge. If you want a finer granularity you need to run this
from within your application. For example, when a iser accesses your
script, record the current timestamp in session storage. On the next
access, compare the current timestamp with the recorded one and act

>> Increasing this value will make this
>> process more often, setting it to 100 will have PHP run the garbage
>> collector every time a PHP script gets executed (you shouldn't do this -
>> think in concurrency terms...)
>Again, why would congruency be affected by the gc? If the session hasn't 
>timed-out then the gc won't clean it up. If it has then it's ok to clean 
>it up. I obviously am missing something has what you say seems to make 
>sense but I can see it just yet :)

If it hasn't timed out it won't be touched, that's clear - but _if_ it has
timed out it's not guaranteed that the gc has already removed the session
file. Note that there is no expiry check when the session storage is
accessed by session_start(); only the gc process itself checks if it should
remove the session file.

In another message, Jean-Christian Imbeault said:
>*That* I understand and agree with. What I was more interested in was 
>the "concurrency" aspect. Why setting gc to 100 might cause problems 
>with concurrency.

Setting this to 100 means that _any_ script access will start the gc. Which
means that even on a moderately busy server a multitude of gc's will check
the session files, possibly interfering with each other as one gc removes a
file that's being checked by another gc. Might be painless (I haven't
looked at the implementation); but I'd avoid this as far as I could :)

   >O     Ernest E. Vogelsinger
   (\)    ICQ #13394035

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to