about HTTP Authentication
| From: | 李雪明 | Date: | Thu, 20 Jan 2000 16:12:41 +0000 |
| Subject: | about HTTP Authentication | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-14786@lists.php.net to get a copy of this message | ||
The following script doesn't work :(
<?php
if(!isset($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\n";
exit;
} else {
echo "Hello $PHP_AUTH_USER.<P>";
echo "You entered $PHP_AUTH_PW as your password.<P>";
}
?>
Error from IE browser:
Internal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.
Please contact the server administrator, steeven@kali.com.cn and inform
them of the time the error occurred, and anything you might have done
that may have caused the error.
More information about this error may be available in the server error
log.
------------------------------------------------------------------------
--------
Apache/1.3.9 Server at xxx.xxx.xxx.xxx Port 80
the result from "php.exe test.php3":
WWW-Authenticate: Basic realm=""
HTTP/1.0 401 Unauthorized
X-Powered-By: PHP/3.0.14
Content-type: text/html
Text to send if user hits Cancel button
Logs from apache server:
[Thu Jan 20 23:35:06 2000] [error] [client 172.18.76.177] malformed
header from script. Bad header=HTTP/1.0 401 Unauthorized: c:/program
files/apache group/apache/cgi-bin/php.exe
Anybody can help? thanks!
My system:
win98
php 3.0.14 for win32
apache 1.3.9 for win32