PHP_AUTH_* doesn't work on Apache?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I was trying to test the following PHP script and am having some

if (empty($_SERVER['PHP_AUTH_USER']) ||
    header('WWW-Authenticate: Basic realm="Admin Control Panel"');
    header('HTTP/1.0 401 Unauthorized');

'.htmlspecialchars($_SERVER['PHP_AUTH_USER']).'<br />';
echo 'PHP_AUTH_PW: '.htmlspecialchars($_SERVER['PHP_AUTH_PW']);

When I try it on Abyss web server what happens is that I enter "test"
as my username / password and then it echoes them back to me.  On
Apache, it just keeps prompting me for the password.  It's as though
PHP_AUTH_* is never being set.  Any ideas as to why this is and what
I'd need to do to fix it?

Re: PHP_AUTH_* doesn't work on Apache?

yawnmoth wrote:
Quoted text here. Click to load it

I know, I know... personal plug = bad taste.... However, I have done  
some work with basic auth through apache/php and did a quick write up:

Posted via a free Usenet account from

Re: PHP_AUTH_* doesn't work on Apache?

Quoted text here. Click to load it

Most likely, your PHP is configured as CGI/FastCGI.  HTTP
authentication, on the other hand, is only supported if PHP is
configured as an Apache module.  Documentation says it quite clearly:

  The HTTP Authentication hooks in PHP are only available when
  it is running as an Apache module and is hence not available
  in the CGI version.

Another possibility is that your Apache installation does not have an
authorization module.


Site Timeline