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,

sess_v3kog1m1943ue0ldu4efqo3qa0
sess_v4ila4d6i5pd0if984n4qqp5s5
sess_v7e48q0e9gc101v9hs9e1c4sb0
sess_v9ef5h87f0h7t56l9hiv6gck77
sess_vadd1reqptalvuphqdn5k80091
sess_vbj05moen6mvc8db5ovkdps3g6

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.