PHP not purging session files on Debian, leading to problems

Hello!

I noticed some weeks ago a PHP site of mine giving errors about not being able to open session files.
I eventually fixed the problems by rm /home/mydomain/tmp/* which had reached the number of files limit.

Now I had time to check more closely what was going on, and I discovered that PHP by default runs a garbage collector to clean up old session files. Not so in debian. The feature is disabled. Instead, debian runs a cron script (/etc/cron.d/php5). See here:

; Define the probability that the 'garbage collection' process is started
; on every session initialization.
; The 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 request.

; This is disabled in the Debian packages, due to the strict permissions
; on /var/lib/php5. Instead of setting this here, see the cronjob at
; /etc/cron.d/php5, which uses the session.gc_maxlifetime setting below
;session.gc_probability = 0
session.gc_divisor = 100

However, that script does not clean any session files in my virtualmin domains.

So I guess Virtualmin should configure the domains' php.ini files accordignly. I dunno which solution is better, if the builtin session.gc_probabilty setting works fine with virtualmin's php5-fcgi implementation, or the creation of a cron script that cleans up all the domains' session files.

Status: 
Closed (fixed)