Welcome Guest, Not a member yet? Register   Sign In
new session id on each page load
#1

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
Reply
#2

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

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

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

https://www.codeigniter.com/user_guide/l...ase-driver

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




Theme © iAndrew 2016 - Forum software by © MyBB