Welcome Guest, Not a member yet? Register   Sign In
Session Fix
#1

[eluser]EyeAmN8[/eluser]
Since there is a lot of open ended posts about CI sessions not working I figured I would share this. I was having problems using sessions and it was giving me a hard time. All it ended up being was the config.php was not setup properly.

My base url and cookie domain did not match! My base url was http://website.com and my cookie domain was www.website.com FYI - website.com is not my site, just an example

Incase you are new to CI like me check your config file to make sure that the two fields match


CodeIgniter v 2.1.3, with pretty much all of the default configs

application
-config
-config.php
line 17
Code:
$config['base_url'] = 'http://website.com';
line 268 - 271
Code:
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "website.com"; // problem was www.website.com
$config['cookie_path']  = "/";
$config['cookie_secure'] = FALSE;

This doesn't cover all the details, but just the "basic" configuration that I missed!




Theme © iAndrew 2016 - Forum software by © MyBB