Jun 26, 2006
PHP and Session time outs!
While working on a text on PHP v4 vs PHP v5 to go here I had a session time out.
So that needed to be fixed first... After some research on php.net I decided to try and do
in my script configuration file, that should do the trick I hope. I will soon enough notice if this succeeded or if I need to take more elaborate measures, which is probably the case.
The sessioning mechanism in PHP will clean up session files occasionaly and will use the 'session.gc_maxlifetime' constant defined in php.ini to check if a session file is outdated.
- The session.gc_probability and session.gc_divisor define the probability that the PHP garbage collector will start on session initialization. session.gc_probability defaults to 1 and session.gc_divisor defaults to 100. The probability is calculated by dividing gc_probability/gc_divisor. Default values 1/100 mean there is a 1% chance that the garbage collector will start..
- session.gc_maxlifetime specifiesoccasionally the number of seconds after which data will be seen as 'garbage' and cleaned up. Now there is a big catch with this; if different scripts have different values of session.gc_maxlifetime but share the same place for storing the session data then the script with the minimum value will be cleaning the data.
I allready store session files in a private dir, but I will probably need to store them in individual directories to overcome all time out problems on a server that is used by more than 1 site of mine. I will keep you updated!
There are no comments on this blog entry yet!
Send your comments to or post them right here!