Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP $_SESSION not staying across localhost subdomains
    primarykey
    data
    text
    <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/644920/allow-php-sessions-to-carry-over-to-subdomains">Allow php sessions to carry over to subdomains</a> </p> </blockquote> <p>Kind of complicated, but I've got 4 subversion repositories that I want to run side by side on my localhost for testing.</p> <p>I set php.ini as so:</p> <pre><code>session.cookie_domain = ".localhost.com" </code></pre> <p>I setup my hosts file:</p> <pre><code>127.0.0.1 vader.localhost.com 127.0.0.1 luke.localhost.com </code></pre> <p>When I login, it sets the cookie correctly.</p> <pre><code> Name: PHPSESSID Content: b0d3h7nh5ff40sms26q04oasq3 Domain: .localhost.com Path: / </code></pre> <p>I set the $_SESSION variable on login:</p> <pre><code>$_SESSION['authorized'] = true; </code></pre> <p>Reload the page, the headers are correct:</p> <pre><code>Cookie PHPSESSID=b0d3h7nh5ff40sms26q04oasq3 Host vader.localhost.com Referer http://vader.localhost.com/ </code></pre> <p>But the $_SESSION variable is empty.</p> <p>This all works fine if I remove the subdomain.</p> <p>Thoughts?</p> <p><strong>EDIT:</strong></p> <p>Suhosin is NOT installed.</p> <p>Also, someone asked for the full code for the session setting:</p> <pre><code>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; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload