Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic Authentication when Server API = CGI

Status
Not open for further replies.

DaHapMan

Programmer
Oct 31, 2000
20
0
0
NL
I use basic authentication like this:

[tt]
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('HTTP/1.0 401 Unauthorized');
header(' Basic realm="My Realm"');

echo 'Text to send if user hits Cancel button';
exit;
} else {
echo &quot;<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>&quot;;
echo &quot;<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>&quot;;
exit;
}
[/tt]

It always worked fine. Now I want to use it on an other server and it gives me an Internal Error!
The only difference I've noticed is the Server API... on the working machine is has the value APACHE, on the other machine CGI. Is this the problem? And if so, what do I have to change in order to get this script working ??

Hope someone can help... thnx
 
thnx ! I could have found that myself...
Next time I go to php.net BEFORE I post something :)

DaHapMan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top