title: HTTP authentication works correctly on local server but incorrectly on remote server
body: <p>Can anyone please tell me why on a remote server when I type the correct username and password, it still tells me that the password is incorrect, while on a local server it all works fine? Thank You!</p>
  
  <pre><code>&lt;?php
  $username = sha1("random");
  $password = sha1("random"); 
  if((!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) || 
  (sha1($_SERVER['PHP_AUTH_USER']) != $username || sha1($_SERVER['PHP_AUTH_PW']) != $password)){
      header('HTTP/1.1 401 Unauthorized');
      header("WWW-Authenticate: Basic realm='My realm'");
      exit("Please enter the correct password");
  }
  ?&gt;
  </code></pre>