Welcome Guest, Not a member yet? Register   Sign In
CI Sessions config question
#1

Hey Guys,

I seem to have an issue with my Sessions config where it isn't doing what I am anticipating.  I am trying to set sessions to never expire; however, they all seem to expire within a few days.

I am using the database driver and the oldest timestamp on any ci_session record is ~5 days ago.  (the table has just over a million records in it currently).  Below is my settings and any insight would be much appreciated.

PHP Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'ci_sessions';
$config['sess_expiration'] = 157680000;
$config['sess_save_path'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 157680000;
$config['sess_regenerate_destroy'] = FALSE;
$config['sess_use_database'] = TRUE
Reply
#2

1) sess_time_to_update has nothing to do with how long the session is supposed to last, so you should reset that value.

2) sess_use_database will have no effect in CI 3.0.

3) Everything else looks right, and that your sessions should last 5 years.

4) If it's not a bug in your code, then perhaps a bug in CI's garbage collection?
Reply
#3

Thanks for the help. I'm not cleaning up any old sessions in my code (that I know of).

Also thanks for the help on those other settings, I knew they were kind of a mix from CI 2. and 3. I will clean those up.

Any idea where the CI garbage collection happens? I'm curious to have a look through it.
Reply
#4

For the database driver, garbage collection is done in the gc method, near line 330 of system/libraries/Session/drivers/Session_database.php
Reply




Theme © iAndrew 2016 - Forum software by © MyBB