HTTP Authentication with PHP
| From: | Joey | Date: | Thu, 01 Jun 2000 14:34:55 +0000 |
| Subject: | HTTP Authentication with PHP | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-801@lists.php.net to get a copy of this message | ||
Hello,
I hoping someone can help me out with this. Here is the web server
config.
Sun Solaris
Netscape Web Server
PHP installed as module
I'm getting the following error.
trying to GET /joey/auth.php3, cgieng_scan_headers reports: the CGI program
/usr/local/bin/php
did not produce a valid header (name without value: got line "http/1.0 401
unauthorized")
Here is my code.
<?php
// File Name: auth01.php
// Check to see if $PHP_AUTH_USER already contains info
if (!isset($PHP_AUTH_USER)) {
// If empty, send header causing dialog box to appear
Header("WWW-Authenticate: Basic realm=\"My Private Stuff\"");
Header("HTTP/1.0 401 Unauthorized");
echo 'Authorization Required.';
exit;
}
// If not empty, display values for variables
else {
echo "
<P>You have entered this username: $PHP_AUTH_USER<br>
You have entered this password: $PHP_AUTH_PW<br>
The authorization type is: $PHP_AUTH_TYPE</p>
";
}
?>
This is just a test to see how well it works but I can't get it to work.
According to all documentation this should work fine. I tried with IE and
Netscape ( different versions) and still nothing. I hope someone can shed
some light on this problem.
Thanks
Joey ( Newbie)