Why is simple PHP header authorization not working
<p>I have the following code which I use on three sites that are all hosted through the same account:</p>

<pre><code>$username = 'test'; 
$password = 'test';

If (!isset($_SERVER['PHP_AUTH_USER'])|| !isset($_SERVER ['PHP_AUTH_PW'])||
    ($_SERVER['PHP_AUTH_USER'] != $username) || ($_SERVER['PHP_AUTH_PW'] != $password)){

//send this if the user and pass arent correct

header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic Realm= "mysite"');
exit('&lt;h2&gt; Go away Creep!!&lt;/h2&gt; you need a username and password to enter this kingdom!!');
}
</code></pre>

<p>It worked completely fine until I upgraded to a newer box a few days ago. Hosting company says everything is good on their end and server migration went fine, yet this script all of the sudden does not work. I input proper user and pass and the dialog simply prompts me again for the user and pass.</p>

<p>What could have possibly changed that would make this code not work? Is there something in htaccess that could someone be influencing it? Server settings? </p>

<p>PHP version on new box is 5.2 but I can upgrade to 5.3</p>

<p>Any help appreciated.</p>
