Welcome Guest, Not a member yet? Register   Sign In
CI4 sessions still not being deleted
#1

(This post was last modified: 03-27-2020, 05:55 AM by Fido L Dido.)

I've read the other threads on session files not being cleaned up on CI4. I am suffering the same issue, with hundreds of session files when it is only me accessing the site.

I've checked which php.ini file apache is using and have set the following values:
Code:
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440

I've also located all other php.ini files and set the same values. I've checked my syslog and it does appear that php/sessionclean is running periodically. Beyond writing my own cleanup routine I'm at a bit of a loss as to how to fix this or even go about debugging what might be going wrong?
Reply
#2

Using 1/1000 can result it quite a large build-up of old sessions. Try these settings for a while to see if things get cleaned up.

Code:
session.gc_probability = 1
session.gc_divisor = 2
session.gc_maxlifetime = 1440

Those values are only temporary to see if GC will happen. If the extreme 1/2 doesn't work then you can be certain that something is wrong. If it does work you can settle on a more reasonable set of values.

Code:
session.gc_probability = 1
session.gc_divisor = 100

The php/sessionclean you are seeing in the log might be a CRON job that is scanning some directory other than the one you have set up for CodeIgniter to use. In other words, it's not directly related to PHP/SESSION garbage collection.
Reply
#3

(This post was last modified: 03-27-2020, 10:57 AM by jreklund.)

(03-27-2020, 07:16 AM)daveĀ friend Wrote: Using 1/1000 can result it quite a large build-up of old sessions. Try these settings for a while to see if things get cleaned up.

Code:
session.gc_probability = 1
session.gc_divisor = 2
session.gc_maxlifetime = 1440

Thanks Dave, I'll give that a go and report back. I've just 'done the maths' on my current settings and realise it equates to a clearout on average every 16-17 days, and I've only have a weeks worth of data. I may have been a little premature.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB