CodeIgniter Forums

Full Version: (Solved) Many session files (112k in 3 days)(admin accessed only by me)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi!

I use CI 3.1.2

The system is a private admin that is only accessed by me.

I think the config it is ok....

The system is creating many many session files, look my config:

Code:
$config['sess_driver'] = 'files';
$config['sess_cookie_name'] = 'MYC_session';
$config['sess_expiration'] = 60*60*24*365; // full year;
$config['sess_save_path'] = '/home/MYFOLDER/_sessions/';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = TRUE;

$config['cookie_path']        = '/';
$config['cookie_secure']    = TRUE;
$config['cookie_httponly']     = TRUE;


Thanks a lot.
@lwmirkk,

1st recommendation (assuming it's possible) upgrade CI version to current version.
2nd, config 'sess_expiration' is set wrong. read the documentation (assuming you don't want it to expire).
3rd, I recommend that you read the CI documentation regarding sessions ( https://www.codeigniter.com/user_guide/l...sions.html )
(03-05-2018, 07:41 PM)php_rocs Wrote: [ -> ]@lwmirkk,

1st recommendation (assuming it's possible) upgrade CI version to current version.
2nd, config 'sess_expiration' is set wrong.  read the documentation (assuming you don't want it to expire).
3rd, I recommend that you read the CI documentation regarding sessions ( https://www.codeigniter.com/user_guide/l...sions.html )

Hi!

Thanks a lot.

1 - Upgraded to the last version to test.
2 - True, the value is not correct, changed to 0.
3 - I changed the default path to a custom path because when in the default path (tmp?), the session expires some hours later, in a custom path, this problem does not occur. I changed to the default path again after the upgrade to test if everithing works fine.

Thanks again. Smile
Changed to database driver to see if the problem occurs.
A new row is inserted every second with a new session_id each page is accessed (same IP)... It is normal?
my config is:

Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'my_session';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_time_to_update'] = 3000;
$config['sess_regenerate_destroy'] = TRUE;
UPDATE:
It is my fault...
With session lib in autoload the session id is generated each request, but some request is from an App, so the CI recognize each request as a new client and not the same.

Changed the session lib to not autoload and load only when necessary (most part of the time)...