Welcome Guest, Not a member yet? Register   Sign In
Manage Session folder
#1

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.
Reply
Reply
#3

Thanks for the reference.
Below is my setting but it's not deleting the files.

$sessionRegenerateDestroy = false;
Reply
#4

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 ?
CMS CI4     I use Arch Linux by the way 

Reply
#5

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
Reply
#6

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.
Reply
#7

Create controller with run() method
Write session_gc() in action
Set task to cron: * * * * * wget -O http://site.com/cron/run
Reply
#8

Thanks Ozornick. Your solution worked perfect.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB