HTTP Basic auth and FastCGI

Discussion in 'Tips/Tricks/Mods' started by NdK, Apr 22, 2011.

  1. NdK

    NdK Member

    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 :
    Code:
    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 ).
     

Share This Page