![]() |
Sessions do not persist - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6) +--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17) +--- Thread: Sessions do not persist (/showthread.php?tid=64785) |
Sessions do not persist - pascal - 03-25-2016 Hi,
PHP Code: $config['sess_driver'] = 'database';
PHP Code: print_r($this->session);
PHP Code: print_r($this->session);
PHP Code: print_r($this->session); On my local server (MAMP) the data is being serialized and stored as such in the session files/DB records. I can browse and view the contents and they look like this: mydata|i:1; If I put some code to log the value of $session_data when CI's session handler's "write" function is called, the value is human-readable. On my live server (WHM/cPanel) the data looks like this: wNR0Bm_RZU-Gt2w1fpFBeW6SKzaFCx4LBB0U4CsZjms. The session handler's write function is being passed the data this way. I'm not sure if this has anything to do with the fact that sessions don't persist, but this is the only lead I have. Basically, if I refresh the page, the client sends the previous session id: Code: Request Headers: and is given a new one every time: Code: Response Headers:
RE: Sessions do not persist - pascal - 03-27-2016 I resolved the issue after I noticed that: - when the URI contained the character "1" the sessions seemed to carry over - preventing the http-referer from being sent also seemed to have an effect on whether the session would be kept Found this setting in php.ini: session.referer_check = 1 Seems harmless at first, except: "session.referer_check contains the substring you want to check each HTTP Referer for. If the Referer was sent by the client and the substring was not found, the embedded session id will be marked as invalid. Defaults to the empty string." |