0

Possible Duplicate:
Cross domain PHP Sessions

I have an IIS6 / WIMP system.

When a user visits a page on:

http://subdomain1.domain.com

then a page on:

http://subdomain2.domain.com

I need the session id to stay the same. I do not need to retain the session variables, just the session id. Each sub domain is setup as a separate site in IIS.

I would like to configure this through IIS, but if I have to do it through php that would work as well.

Community
  • 1
  • 1
Crunchline
  • 15
  • 4
  • Take a look at this answer for how to do it with PHP http://stackoverflow.com/questions/7324822/php-session-lost-on-subdomain – Geek Num 88 Nov 09 '12 at 16:26

1 Answers1

1

You should change session.cookie_domain directive in your php.ini file, or you can use PHP ini_set function.

You change it using ini_set function like this:

ini_set('session.cookie_domain', '.domain.com');

You should do this somewhere at bootstrap level. This should work. I had similar situation where I had to create session at www.domain.com, and then use that session on www.subdomain.domain.com. And it works great.

Hope this helps!

Matija
  • 2,610
  • 1
  • 18
  • 18
  • I placed the ini_set value in an include file that was used by all pages, but that didn't help. I specified the session.cookie_domain in the php.ini and that resolved the issue. – Crunchline Nov 09 '12 at 17:37