Welcome Guest, Not a member yet? Register   Sign In
Session Garbage collection
#1
Question 
(This post was last modified: 03-03-2023, 06:50 PM by kenjis.)

On some shared hosting, PHP's automatic Garbage collection is effectively disabled, and replaced with a CRON job (session.gc_probability and session.gc_divisor are set so garbage collection never happens)

Because CodeIgniter stores session files in the "writeable" folder, the CRON job does not clear the files and the disk fills up.

https://forum.codeigniter.com/showthread...ht=garbage

\App\Config\Session::sessionExpiration sets the ini value for session.gc_maxlifetime

Can we add \App\Config\Session::sessionProbability


sessionProbability will ini_set session.gc_probability and session.gc_divisor
Reply
#2

session.gc_maxlifetime=[choose smallest possible]
Code:
session.gc_maxlifetime
 is a setting for deleting obsolete session ID. Reliance on this setting is [i]not[/i] recommended.
Developers should manage the lifetime of sessions with a timestamp by themselves.


Session GC (garbage collection) is best performed by using session_gc(). The session_gc() 

function should be executed by a task managers. E.g. cron on UNIX like systems.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB