CodeIgniter Forums
new session id on each page load - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html)
+--- Forum: General Help (https://forum.codeigniter.com/forum-24.html)
+--- Thread: new session id on each page load (/thread-66947.html)



new session id on each page load - tamasszabo - 12-21-2016

Every time I load/refresh a page CI generates a new session.
Code:
$config['sess_driver'] = 'database';
$config['sess_cookie_name'] = 'CIsession';
$config['sess_expiration'] = 7200;
$config['sess_save_path'] = 'sessions';
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 7200;
$config['sess_regenerate_destroy'] = FALSE;

I call session library in autoload
Code:
$autoload['libraries'] = array('session');

I have a coockiedomain set correctly
Code:
$config['cookie_domain']    = ".mydomain.com";

It stores the data in my database correctly, but on every page-load generates a new session. There are no errors in Apache nor in CI log. Do you have any ideas where to start? Thank you


RE: new session id on each page load - PaulD - 12-21-2016

Are you on a localhost? Try leaving the cookie domain blank, does it still create new sessions on page load?


RE: new session id on each page load - tamasszabo - 12-22-2016

Yes, on localhost. And tried blank cookie domain. Same issue.


RE: new session id on each page load - skunkbad - 12-23-2016

Make sure to read carefully the documentation on setting up your CI sessions table:

https://www.codeigniter.com/user_guide/libraries/sessions.html#database-driver

Especially the part about the primary key and "sess_match_ip".