Manage Session folder |
Hi,
I have noticed that my 'writable/session' folder on the server is getting massive. Is there a way to flush/delete these files automatically. Thanks.
If you manage your own server:
> https://www.codeigniter.com/user_guide/l...references > https://www.php.net/manual/en/function.session-gc.php
Thanks for the reference.
Below is my setting but it's not deleting the files. $sessionRegenerateDestroy = false;
i'm on linux , this cleared my session dir and left the index.html intact
Code: sudo rm /srv/http/ads.com/writable/session/ci_* So if you set up a cron job as root , using something similar at a good estimated time interval , then that would periodically clear, I assume the server is linux OS ?
Do not use manual removal. When switch to table storage, you need to generate new cleanup code.
Set session.gc_probability or execute session_gc() in cron script. The function will work with tables and files, comparing session times
Hi All,
Yes I'm on Linux (ubuntu). I thought Ci was capable to clean the sessions it self. I got about 4 separate sites running via virtual servers so I'm not quite sure how I can clean all 4 session folders via "session_gc()" with cron.
Create controller with run() method
Write session_gc() in action Set task to cron: * * * * * wget -O http://site.com/cron/run |
Welcome Guest, Not a member yet? Register Sign In |