Welcome Guest, Not a member yet? Register   Sign In
Sessions do not persist
#1

Hi,
  • Configuration
PHP Code:
$config['sess_driver'] = 'database';
$config['sess_save_path'] = 'ci_sessions';
$config['sess_cookie_name'] = 'sb_session';
$config['sess_expiration'] = 86000;
$config['sess_match_ip'] = FALSE;
$config['sess_time_to_update'] = 300;
$config['sess_regenerate_destroy'] = FALSE
  • /system folder is identical to ci3 git repo
PHP Code:
print_r($this->session);
echo 
"<a href='/test/beta'>next</a>";
print_r($_COOKIE); 
  • have some test routes set up in routes.php to go to a test controller
  • test controller, page 1 (/test/alpha)
PHP Code:
print_r($this->session);
$this->session->set_userdata('mydata'1);
print_r($this->session);
echo 
"<a href='/test/beta'>next</a>";
print_r($_COOKIE); 

  • test controller, page 2 (/test/beta)
PHP Code:
print_r($this->session);
echo 
"<a href='/test/alpha'>back</a>";
print_r($_COOKIE); 

  • Database table contents:     

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:
GET /test/alpha/beta HTTP/1.1
[...]
Cookie: mr_csrf_cookie=7fd571f8bf56780bf129e331aca20ec0; sb_session=bd58c63518a25e3d2e994e555d003d720fda04f5

and is given a new one every time:
Code:
Response Headers:
Set-Cookie:sb_session=b8c24a58de4c1140af6b7938f045e0f423742006; expires=Sun, 27-Mar-2016 03:24:54 GMT; Max-Age=86000; path=/; HttpOnly
  • Behavior is independent of session storage type (file/database)
  • I've been stuck on this for two days now.
Any help would be greatly appreciated.
Reply


Messages In This Thread
Sessions do not persist - by pascal - 03-25-2016, 08:35 PM
RE: Sessions do not persist - by pascal - 03-27-2016, 06:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB