1

I have 2 CodeIgniter installations, 1 on mydomain.com another on sub.mydomain.com.

I am trying to get sub.mydomain.com to be able to access the CI session created by mydomain.com. I have edited the cookie section of both config files to:

$config['cookie_prefix']    = "";
$config['cookie_domain']    = ".mydomain.com";
$config['cookie_path']      = "/";
$config['cookie_secure']    = FALSE;

Now if I go to mydomain.com setting the session and then go to sub.mydomain.com it seems to overwrite the session with a new one rather than being able to read from the existing session.

Am I missing something here?

halfer
  • 19,824
  • 17
  • 99
  • 186
Martin Hunt
  • 1,135
  • 2
  • 14
  • 23

1 Answers1

2

This was driving me crazy for hours but the solution (as usual) was simple. I had forgotten to make sure

$config[‘encryption_key’]

was the same for both applications!

Working great now

Martin Hunt
  • 1,135
  • 2
  • 14
  • 23
  • I'm using alias so `encryption_key` is 100% the same, but I have the same issue: http://stackoverflow.com/questions/18853783/codigniter-share-session-with-subdomain-sess-time-to-update – Yevgen Sep 17 '13 at 15:36