Possible Duplicate:
Allow php sessions to carry over to subdomains
Kind of complicated, but I've got 4 subversion repositories that I want to run side by side on my localhost for testing.
I set php.ini as so:
session.cookie_domain = ".localhost.com"
I setup my hosts file:
127.0.0.1 vader.localhost.com
127.0.0.1 luke.localhost.com
When I login, it sets the cookie correctly.
Name: PHPSESSID
Content: b0d3h7nh5ff40sms26q04oasq3
Domain: .localhost.com
Path: /
I set the $_SESSION variable on login:
$_SESSION['authorized'] = true;
Reload the page, the headers are correct:
Cookie PHPSESSID=b0d3h7nh5ff40sms26q04oasq3
Host vader.localhost.com
Referer http://vader.localhost.com/
But the $_SESSION variable is empty.
This all works fine if I remove the subdomain.
Thoughts?
EDIT:
Suhosin is NOT installed.
Also, someone asked for the full code for the session setting:
if (authenticate($dat['username'], $dat['password'])) {
session_start();
$_SESSION['authorized'] = true;
$_SESSION['username'] = $dat['username'];
$_SESSION['userType'] = findId('t_user', 'username', $dat['username'], 'userTypeId');
$_SESSION['userId'] = findId('t_user', 'username', $dat['username'], 'userId');
$_SESSION['contactId'] = findId('t_user', 'username', $dat['username'], 'userContactId');
array_push($reply, $reply);
$reply['authorized'] = true;
}