I don't know why but my CodeIgniter application is creating too many ci_sessions file at server tmp folder. like 1000 session file ever min. and seems not deleting old session file
I am using this settings
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 0;
$config['sess_save_path'] = NULL;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 1000;
$config['sess_regenerate_destroy'] = TRUE;
How to get rid this issue ?

In your php.ini add this
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
Also in your codeigniter configuration file check that you have enabled the regenerate_destroy and expiration enabled.
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = ‘mysession';
$config['sess_expiration'] = (60 * 60);
$config['sess_save_path'] = FCPATH . "sessions";
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;
Basically gc_probability is set by default in 0 and those files can't be deleted. So changed to 1 enable the file deletion automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With