php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29161 no PHP_AUTH_USER under Apache 1.3.28
Submitted: 2004-07-14 20:34 UTC Modified: 2004-07-15 08:16 UTC
Votes:4
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:1 (33.3%)
From: vahan at arminco dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.0.0 OS: Windows XP SP1
Private report: No CVE-ID: None
 [2004-07-14 20:34 UTC] vahan at arminco dot com
Description:
------------
HTTP auth doesn't work because $_SERVER['PHP_AUTH_USER'] is not being set, while $_SERVER['PHP_AUTH_PW'] is there as shown by phpinfo()

to reproduce:
create this file:

<?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>";
  }
?>

access the file, when it gives you the user/pass box, alter the script, adding phpinfo() in the 2nd line, and type something as user and password. phpinfo() shows PHP_AUTH_PW but no PHP_AUTH_USER. all auth fails because of this, tested on windows 2003 professional and windows 2000 sp4 servers as well, with apache 1.3.28 and php-5.0.0 installed as module.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-14 20:39 UTC] vahan at arminco dot com
Forgot to add that the same servers were working flawlessly under 4.3.8, downgraded from 5.0 now back to 4.3.8, everything works ok.

seems this is a problem with 5.0.0
 [2004-07-14 20:43 UTC] jeff at j-maxx dot net
I am  having the same problem. 
I tested using the above code and this code
<?
if(!isset($_SERVER['PHP_AUTH_PW'])){
header( 'WWW-Authenticate: Basic realm="Test PHP Auth"');
		header( 'HTTP/1.0 401 Unauthorized');
		exit;
} else {
	phpinfo();
}		
?>

My server is Red Hat 9.0, Apache 1.3.31 and PHP 5.0.0 compiled with 
'./configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-mysql=/usr/' '--with-gd' '--with-mhash' '--with-xml' '--with-t1lib' '--with-ttf' '--with-freetype-dir=/usr/lib' '--with-zlib' '--with-jpeg-dir=/usr/local/lib' '--with-png-dir=/usr/lib'

I have also tested it in Apache 2 on Windows XP SP1 with the same results.

This is a major problem for me. I cannot upgrade to PHP 5 till this is resolved.
 [2004-07-14 23:42 UTC] edink@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2004-07-15 03:22 UTC] jeff at j-maxx dot net
It works. I'm able to login with no problems. 

Whats the difference between this snapshot and the 5.0.0 release?
 [2004-07-15 08:16 UTC] tony2001@php.net
Duplicate. See #29132
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Sep 14 13:00:01 2025 UTC