06-28-2018, 11:01 AM
I've noticed that in my writable/sessions directory there are a zillion files. Do these keep accumulating or are they deleted at some point?
Simpler is always better
Session files
|
06-28-2018, 11:01 AM
I've noticed that in my writable/sessions directory there are a zillion files. Do these keep accumulating or are they deleted at some point?
Simpler is always better
06-28-2018, 12:38 PM
It's handled by PHP's own garbage collection routine, which by default on many systems run every 100th request. It's possible there's a bug in the system, but largely dependent on what OS you're running and your server settings. Here's a decent explanation of what's going on and ways to work with it, even though it uses Symfony and Laravel for examples.
When GC happens, this should be ran.
06-28-2018, 02:24 PM
Clean up is determined by the PHP runtime configuration items gc_probability divided by gc_divisor. That ratio defines the probability that the GC (garbage collection) process is started on any session initialization. So, given 1/100 there is a 1% chance that the GC process starts. (docs)
I've highlighted probability and chance to point out there is no guarantee GC will happen once every 100 times per the 1/100 example. It could happen twice in a row and then not again for 200 (and potentially many more) session initializations. |