Why is Garbage Collection Disabled in PHP INI?
My server's tmp folder was filling up with PHP session files. I know Cpanel has a cron event to clean up PHP session files but this wasn't cleaning this particular PHP installation.
I checked the ini file and session.gc_probability=0 and session.gc_divisor=0 were set and the comments in the ini file send session.gc_probability=1 is the default and session.gc_probability=100 is the default.
Is Cpanel using these =0 settings on purpose and for a reason or did me (or another admin) change it a long time ago and not remember and it's just been carried from server to server when migrating config files?
-
Hey there! I checked a clean cPanel system and I see the defaults you mentioned on my machine, so I think your guess of "it was changed at some point in the past" is the most likely answer.
0 -
session.gc_probability=0 and session.gc_divisor=0 in all servers I checked.
I never touched those settings.
You can do:
grep "session.gc_probability" /opt/cpanel/ea-*/root/etc/*.ini | grep -v ";"
and
grep "session.gc_divisor" /opt/cpanel/ea-*/root/etc/*.ini | grep -v ";"If you look in /usr/local/cpanel/scripts/clean_user_php_sessions you see:
"We only remove files with session.save_path that contain /sess_.*/ by default."0
Please sign in to leave a comment.
Comments
2 comments