CodeIgniter Forums
What could be invalidating my ci_sessions records? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: What could be invalidating my ci_sessions records? (/thread-50564.html)



What could be invalidating my ci_sessions records? - El Forum - 03-30-2012

[eluser]warpspasm[/eluser]
Hi Everyone,

For some reason my CI sessions are invalidating after a (I think) random time.

If I create a session, I get a good looking record in the ci_sessions table:

0a90a843f69fe8fc95b03a6874c3b8f3 xx.25.101.99 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11 1333114843 a:10:{s:6:"Myid";s:1:"5";...}

Sometimes within 5 minutes of starting a session, I will make a call to $this->session->userdata('Myid') or some other data and it will come back blank and I can see a new record has been created in ci_sessions:

dcd5c8a5e022c2df4f09bfeed9fd3100 xx.25.101.99 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11 1333114843

Then I need to recreate the session (through my login proceudure) and I get yet another new record in the ci_sessions table:

de6d60bfc9f1de0d42af490c85084a88 xx.25.101.99 Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:11 1333114843 a:10:{s:6:"Myid";s:1:"5";...}

I am using CodeIgniter 2.0.2 and I have set my user sessions to never expire, so this should never happen right?

$config['sess_cookie_name'] = 'cookie_nibs';
$config['sess_expiration'] = 0;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;

Does anyone have any idea what might be causing this issue and how I might fix it?

Thanks!


What could be invalidating my ci_sessions records? - El Forum - 03-30-2012

[eluser]InsiteFX[/eluser]
Code:
$config['sess_time_to_update'] = 300;  // 300 = 5 minutes raise it up for a longer time period



What could be invalidating my ci_sessions records? - El Forum - 03-30-2012

[eluser]warpspasm[/eluser]
It was my understanding that sess_time_to_update is the minimum time that must pass before the last activity value will be changed.

As much I wish changing this value would fix things, I don't think it is the problem.