I am using cakephp4.0 file based sessions for our website. We are using Auth Component for user sessions. Basically, I never want my user session to expire but the issue the the /tmp/sessions folder is getting too big. I have a custom gc collection in place that removes all the non-modified files older than 7 days. Earlier we were using database sessions and we could see that somehow cake was scanning the whole database table so we moved to file based sessions. The issue I have identified is that cakephp is creating one file on every request thus after every now and then we see in the stack trace that all the files in the session folder is being scanned the PHP process is hanged. Below is my bootstrap.php
Configure::write('Session', array(
'defaults' => 'cake',
'timeout' => 525600,
'ini' => [
'session.gc_maxlifetime' => 315360000,
'session.gc_probability' => 1,
'session.gc_divisor' => 100,
'session.cookie_lifetime' => 315360000,
'session.cookie_samesite' => 'none',
'session.cookie_secure' => 'true',
'session.use_strict_mode' => '0',
// 'session.cookie_domain' => '*******.io',
],
)
);
Is there something we are doing wrong? Also if Iremove all the session files everyday would that logout all the users?