CodeIgniter Forums
Session Fix - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Session Fix (/thread-57034.html)

Session Fix - El Forum - 02-08-2013

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 and my cookie domain was FYI - 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

line 17
$config['base_url'] = '';
line 268 - 271
$config['cookie_prefix'] = "";
$config['cookie_domain'] = ""; // problem was
$config['cookie_path']  = "/";
$config['cookie_secure'] = FALSE;

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