PHP Sessions garbage collection problem

Recently my partition size reach 100% of inodes in a couple of days. The partition had thousands of php sessions files,


Php was not cleaning the old sessions, so the partition reach the 100% size of inodes often.

I don’t know why but in Debian PHP 5.3.3,¬†the garbage collection settings doesn’t delete the old sessions.

If you go to your /etc/php5/apache2/php.ini you will find:

session.gc_probability = 0
session.gc_divisor = 1000

It’s quite weird, because that setting shouldn’t influence in the deletion of the sessions files. You will find this settings in

session.gc_maxlifetime = 1440

But I’m pretty sure, the session files wasn’t deleted after 24min (1440 secdons / 60).

So I changed the garbage collection settings to:

session.gc_probability = 1
session.gc_divisor = 100

And now the sessions are deleted successfully.