PHP Authentication ( Header )
| From: | Joey | Date: | Wed, 28 Jun 2000 15:53:06 +0000 |
| Subject: | PHP Authentication ( Header ) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3584@lists.php.net to get a copy of this message | ||
Hello,
I've read all the postings in this ng and haven't anybody with the same
problem as myself. So I hope someone can help me out. I'm trying to use the
Header() function to authenticate users on my site. I doesn't work at all. I
get a server error. ( will post errors bellow ) Now I can use Header() to
redirect or even expire a page so it doesn't stay in the browers cache. But
the following code gives me the errors bellow it.
<?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>";
}
This gives me the following error in my web browser.
Server Error
This server has encountered an internal error which prevents it from
fulfilling your request. The most likely cause is a misconfiguration. Please
ask the administrator to look for messages in the server's error log.
I know this doesn't mean much to you so here is the error in the server log
file.
[28/Jun/2000:11:48:09] failure (25755): for host xxx.xxx.xxx.xxx trying to
GET /test/test.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")
Everything else i have tried so far has worked. So i'm thinking it's
something we forgot in the configuration of the server.
Can anyone tell me where to start looking for a solution. Here is the server
setup.
Solaris 8 OS
Netscape Enterprise Server
PHP 4.0 compile as NSAPI Module
Thanks
JD