PHP session garbage collection and PHPSESSID_TTL

Discussion forum about Anuko Time Tracker
Post Reply
Semper
Posts: 17
Joined: Mon May 20, 2019 6:25 pm

PHP session garbage collection and PHPSESSID_TTL

Post by Semper » Mon Jul 15, 2019 9:14 pm

Hello.

I run a LAMP server with the automatic garbage collection of PHP disabled (i.e., with "session.gc_probability = 0" in "/etc/php.ini" and with the PHP default of "session.gc_maxlifetime = 1440"), and then I run a cron script early in the morning to periodically delete old PHP session files from folder "/var/lib/php/session/" (which is the default in CentOS). I do this because my LAMP server has a slow disk and this should improve a little the speed of PHP. It works fine.

Also, I set up Anuko Time Tracker with these options in "WEB-INF/config.php" (so that the session time-out is three days):

Code: Select all

define('PHPSESSID_TTL', 259200);
define('PHP_SESSION_PATH', '/var/run/timetracker');
And it works fine, but I see that automatic garabage collection is happening for the old PHP session files in folder "/var/run/timetracker" (which are TimeTracker-related). Is this normal, considering that I set up "session.gc_probability = 0" in the global "/etc/php.ini" file? How could I tell TimeTracker to not do automatic garabage collection of old PHP session files, so that I myself could delete them from a cron script?

Post Reply