php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29181 HTTP Basic AUTH support broken
Submitted: 2004-07-15 11:13 UTC Modified: 2004-07-15 11:16 UTC
From: revengeofthecats at hotmail dot com Assigned:
Status: Not a bug Package: Apache related
PHP Version: 5.0.0 OS: Windows XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: revengeofthecats at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-07-15 11:13 UTC] revengeofthecats at hotmail dot com
Description:
------------
The HTML basic authentication support has stopped working for me after upgrading to PHP5. I'm using Apache 1.3.31 and PHP5.0.0; the *exact* same setup but with PHP4.3.7 works fine. The only change to my php.ini file is changing the include/extensions directory and loading the mysql extensions, which does not seem to be related to the problem.

To reproduce the bug, one may use the first sample script at http://www.php.net/manual/en/features.http-auth.php. You will be asked time and again for your username and password, no matter what you enter.

A little investigation using phpinfo() shows that the $_SERVER['PHP_AUTH_USER'] and $_SERVER['AUTH_TYPE'] are not set. $_SERVER['PHP_AUTH_PW'] is correctly set, however.

Reproduce code:
---------------
example at http://www.php.net/manual/en/features.http-auth.php

<?php
  if (!isset($_SERVER['PHP_AUTH_USER'])) {
   header('WWW-Authenticate: Basic realm="My Realm"');
   header('HTTP/1.0 401 Unauthorized');
   echo 'Text to send if user hits Cancel button';
   exit;
  } else {
   echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
   echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
  }
?> 

Expected result:
----------------
After entering username and password, they are displayed.

Actual result:
--------------
The code keeps asking for username/password time and again. $_SERVER['PHP_AUTH_USER'] is not set.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-15 11:16 UTC] tony2001@php.net
Duplicate. See #29132
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 07:01:33 2025 UTC