Pass Sessions between subdomains in php

01 Aug 2005

If you want to be able to pass session data between subdomains you need to add the following to the php.ini file.

session.cookie_domain = .mydomain.com 

If you are unable to modify the the php.ini file you can add the following before the session.start() function on any page which creates the session cookie.

ini_set("session.cookie_domain", ".mydomain.com");

2 comments

26. At 04:20 PM on November 06, 2005, Lucas wrote:

Worked perfectly well!
Thanks alot!
-Lucas

29. At 05:18 AM on December 24, 2005, Marius M. wrote:

however I got here -- THANK YOU! Especially the second hint is priceless.


Post a comment