RE: [PHP] Internal Server Error?
| From: | Kraa de Simon | Date: | Sun, 06 Jan 2002 18:43:32 +0000 |
| Subject: | RE: [PHP] Internal Server Error? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-79615@lists.php.net to get a copy of this message | ||
This only works if PHP is installed as an Apache module on the Linux/UNIX
platforms.
From the docs:
One additional note about PHP: if PHP is installed as an Apache module on
the Linux/UNIX platforms, there are additional global variables available to
your PHP script:
$PHP_AUTH_USER -- Authenticated User name
$PHP_AUTH_PW -- Authenticated Password
$PHP_AUTH_TYPE -- Authentication Type
Additionally, your PHP program can force Apache to prompt the user for a
username and password with the following PHP commands:
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
From then on, your application logic can decide how to respond to the user.
Note that on the Windows platform, PHP is installed as a CGI, and these
features are therefore not available.
> -----Original Message-----
> From: GoodFella [mailto:goodfella_gf@hotmail.com]
> Sent: zondag 6 januari 2002 17:31
> To: php Mail
> Subject: [PHP] Internal Server Error?
>
>
> Hello,
>
> Does anybody have any ideas why the code below is giving me
> internal server errors?
>
> if (!isset($PHP_AUTH_USER)) {
>
> header('WWW-Authenticate: Basic realm="XYZ Company Admin Area"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
>
> } else if (isset($PHP_AUTH_USER)) {
>
> if (($PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "password")) {
>
> header('WWW-Authenticate: Basic realm="XYZ Company Admin Area"');
> header('HTTP/1.0 401 Unauthorized');
> echo 'Authorization Required.';
> exit;
>
>
> Do I need to set or change anything in my PHP set-up?
>
> Thanks in advance,
>
> GF.
>