I Cannot get the basic HTTP Authentication to work in PHP which is installed and working as FCGI. It works perfectly when PHP is installed as a module though.
Is there any way I can get it to work ???
I am running PHP Version 5.2.6 in ubuntu.
<?Php
if ( !$_SERVER['PHP_AUTH_USER'] ) {
$this->getResponse()->setHeader('WWW-Authenticate', 'Basic realm="Testing"');
$this->getResponse()->setBody('Unauthorized');
$this->getResponse()->setHttpResponseCode(401);
} else {
var_dump($_SERVER['PHP_AUTH_USER']);
var_dump($_SERVER['PHP_AUTH_PW']);
}
I did try
[Rewrite rule on .htaccess]
RewriteEngine on
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
[user:pass on PHP-script]
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(':', base64_decode(substr($_SERVER['REDIRECT_REMOTE_USER'], 6)));
but it doesnt seem to be working.