Page 1 of 1

Managing session variable with Virtual Hosts

Posted: Sun Aug 22, 2004 4:29 pm
by tonic889
I am running Apache 1.3.27 to host "www.mydomain.com". I have "mydomain.com" configured as a ServerAlias. My problem is that when PHP tracks sessions using cookies, it treats them as separate domains. In other words, "www.mydomain.com" gets one PHP Session ID, and "mydomain.com" gets a separate one. Is there any way to configure PHP to use the same session ID for two domain names? (Or, if anyone knows of something in Apache that I should configure differently, let me know...)

Thanks.

Posted: Sun Aug 22, 2004 5:14 pm
by feyd
use [php_man]session_set_cookie_params[/php_man]() to set the domain the cookie will use to: '.mydomain.com' ...... notice the dot in front.