The PHP script is as follows:
Read the manual (emphasis mine):
session.gc_maxlifetime
specifies the number of seconds after which data will be seen as 'garbage' and potentially cleaned up. Garbage collection may occur during session start (depending onsession.gc_probability
andsession.gc_divisor
).
In the same page:
session.gc_divisor
coupled withsession.gc_probability
defines the probability that the gc (garbage collection) process is started on every session initialization. The probability is calculated by usinggc_probability/gc_divisor
, e.g. 1/100 means there is a 1% chance that the GC process starts on each request.session.gc_divisor
defaults to 100.
Now do the math and see that it's not very likely the GC will be called on each request.
You should store the in the session a variable that saves the time of the last activity of the user and use that instead of the session is logically "active". Don't rely on garbage collection.