PDA

View Full Version : HTTP Basic auth and FastCGI


NdK
22nd April 2011, 11:45
Hello all.

I've been bitten twice by this, so I thought to share the solution.
The problem is that, if you use fastcgi(+suexec) your php scripts won't see $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] and scripts that rely on it (obviously) won't work and keep asking credentials.

Just add this rewrite rule in your .htaccess :

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

and all works again.

(credits to the post by Dmitry in http://bugs.php.net/bug.php?id=35752 ).