ID: 29161
Comment by: jeff at j-maxx dot net
Reported By: vahan at arminco dot com
Status: Open
Bug Type: Unknown/Other Function
Operating System: Windows XP SP1
PHP Version: 5.0.0
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2004-07-14 20:39:33] 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:34:10] 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.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29161&edit=1