About the session garbage collection mechanism! Seession. gc_maxlifetime1440; seesion. gc_probalility1; session. gc_divisor1000; in my understanding above, sessions can be used only by users with one thousandth point. but if the probability is one thousandth point, it is wrong. how does the session work ?? Please give me a satisfactory explanation .. ------ Solution-about the session garbage collection mechanism!
Seession. gc_maxlifetime = 1440;
Seesion. gc_probalility = 1;
Session. gc_pisor = 1000;
In my understanding above, sessions can be used by users with one thousandth point. However, if the probability is one thousandth point
That's wrong. how does the session work ?? Please give me a satisfactory explanation ..
------ Solution --------------------
An explanation of the reference:
The principle of PHP session processing is no exception, but the specific implementation method is different. This is because, due to the working mechanism of PHP, it does not have a background thread to regularly scan session information and determine whether it is invalid. The solution is that when a valid request occurs, PHP determines whether to call a GC (Garbage Collector) based on a probability ). GC is to scan all session information, and subtract the current time from the last modification time (modified date) of the session, which is the same as the configuration option session. compare the value of gc_maxlifetime. if the survival time exceeds gc_maxlifetime, delete the session. This is easy to understand, because if the GC code is called every time a request is made, PHP's efficiency will be much lower. This probability depends on the value of the configuration parameter session. gc_probability/session. gc_pisor (which can be modified through the php. ini or ini_set () function ). By default, session. gc_probability = 1, session. gc_pisor = 100, that is, there is a 1% possibility to start GC.
The three parameters, session. gc_maxlifetime/session. gc_probability/session. gc_pisor, can be modified through the php. ini or ini_set () function. Remember that if you use the ini_set () function, you must call ini_set () at the beginning of each page ().
Read Full Text: http://koda.iteye.com/blog/319605