|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11498 HTTP Authentication via PHP using documented code does not work
Submitted: 2001-06-15 04:08 UTC Modified: 2001-06-15 10:01 UTC
From: nateh999 at yahoo dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.0.5 OS: Windows 2000
Private report: No CVE-ID: None
 [2001-06-15 04:08 UTC] nateh999 at yahoo dot com
Hi, trying to do simple HTTP authentication (just to get it working, as the original mySQL connected version did not work -- same "symptoms") with this php code:

  if(!isset($PHP_AUTH_USER)) {
    Header("WWW-Authenticate: Basic realm=\"My Realm\"");
    Header("Status: 401 Unauthorized");
    echo "Text to send if user hits Cancel button\n";
  } else {
    echo "Hello $PHP_AUTH_USER.<P>";
    echo "You entered $PHP_AUTH_PW as your password.<P>";
this is in a standalone file, login.php

it brings up the login prompt, but seems unable to get past that -- entering a login does nothing.  The popup shows 3 times, then it redirects to a page displaying the results of the "echo "Text to send if user hits Cancel Button\n";" line.

Not sure if i'm doing something wrong (doubt it, i copied this code from after trying to write my own (which got the same results)) or if this is a may well be a bug with apache, but perhaps y'all know something about this....

Software setup info:

SERVER_SOFTWARE => Apache/1.3.20 (Win32)
HTTP_USER_AGENT => Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)
PHP Version: 4.0.5


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-15 10:01 UTC]
works for me just fine, you're doing something wrong.
this is wrong place to ask support questions. Try some public forum.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue May 17 13:05:45 2022 UTC