CodeIgniter Forums
Session files keep being created - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: Issues (https://forum.codeigniter.com/forumdisplay.php?fid=19)
+--- Thread: Session files keep being created (/showthread.php?tid=66433)



Session files keep being created - krishg - 10-21-2016

For the same user browsing the site, I keep seeing many session files being generated. The session config I have is
Code:
$config['sess_driver'] = 'files';
$config['sess_save_path'] = APPPATH.'sessions';
$config['sess_cookie_name']        = 'ev_session';
$config['sess_expiration']        = 7200;
// $config['sess_expiration']        = 0;
$config['sess_time_to_update']    = 300;
$config['sess_match_ip']        = FALSE;

/*
|--------------------------------------------------------------------------
| Cookie Related Variables
|--------------------------------------------------------------------------
|
| 'cookie_prefix' = Set a prefix if you need to avoid collisions
| 'cookie_domain' = Set to .your-domain.com for site-wide cookies
| 'cookie_path'   =  Typically will be a forward slash
| 'cookie_secure' =  Cookies will only be set if a secure HTTPS connection exists.
|
*/
$config['cookie_prefix']    = "";
$config['cookie_domain']    = "oursite.com";
$config['cookie_path']        = "/";
$config['cookie_secure']    = FALSE;
Here is what I see in many of the session files
__ci_last_regenerate|i:1477076327;fb_xxxxxx_state|s:32:"45ef7d600d6b53855dd782948fd9ef26";was_prompted_for_location|b:1;location|a:3:{s:4:"city";s:3:"all";s:7:"country";s:2:"US";s:5:"state";s:3:"all";}
Any ideas how this can be avoided?


RE: Session files keep being created - dave friend - 10-21-2016

Every new session creates a new file. The number can build up but do not fear. Expired session files will be deleted automatically it just will not happen very often. When it does occur things will be cleaned up nicely.


RE: Session files keep being created - krishg - 10-21-2016

Not sure why CI treats other page visits as a new session. Same browser, just visiting other pages in the site.