ID: 43682 User updated by: k dot andris at gmail dot com Reported By: k dot andris at gmail dot com Status: Open Bug Type: Session related Operating System: Debian Sarge PHP Version: 5.2.4 New Comment:
I found it! The problem only occours if you serve the base domain and the subdomains from different sections of lighttpd config file, like this: $HTTP["host"] =~ "^mysite\.com" { server.document-root = "/var/www/mysite/" } $HTTP["host"] =~ "(.+)\.mysite\.com$" { server.document-root = "/var/www/mysubdomains/" } Previous Comments: ------------------------------------------------------------------------ [2008-02-10 18:17:20] k dot andris at gmail dot com It seems to work on another server. I'll try to find out what was wrong with the first one. Sorry.. ------------------------------------------------------------------------ [2008-02-10 17:21:06] k dot andris at gmail dot com Did you try getting the session variable set on a subdomain at the root? Like apple.mydomain.com/echo.php sets $_SESSION['apple'] = 'fruit', but mydomain.com/echo.php will not see it. Or does it in your tests? BTW, session_set_cookie_params lack parameter docs, but I guess lifetime is in seconds. ------------------------------------------------------------------------ [2008-02-05 00:28:53] [EMAIL PROTECTED] Try using this instead of ini_set(): http://php.net/session_set_cookie_params Calling this with proper values prior to calling session_start(); works just fine for me. ------------------------------------------------------------------------ [2008-02-02 13:15:14] k dot andris at gmail dot com Host names pass along fine to the script handling the subdomains. Actually I used the subdfomain name to set test session variables, like "a_test2 and "b_test". ------------------------------------------------------------------------ [2008-02-02 13:11:51] k dot andris at gmail dot com So on subdomains it does work all right. What clears the $_SESSION variable is the root domain. Session is passed fine between a.mysite.com and b.mysite.com, but if I open a session at mysite.com, it will not see the subdomain's session variables, and it will also erase them. The session cookie passes along fine. I call: ini_set('session.cookie_domain', '.mysite.com'); session_start(); I thought it does not work because the dot befor thee site's name (since the root does not have that dot), but removing it does not help either. Can you test this? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/43682 -- Edit this bug report at http://bugs.php.net/?id=43682&edit=1