Pages

Friday, December 6, 2013

HTTP Basic Auth with PHP in CGI-mode

phpinfo();
Server APICGI/FastCGI

https://github.com/symfony/symfony/issues/1813

add  to .htaccess file ( in root dir )following :
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
</IfModule>

in php script: 

list($SERVER['PHPAUTH_USER'], $SERVER['PHPAUTH_PW']) = explode(':' , base64_decode(substr($SERVER['HTTPAUTHORIZATION'], 6)));

No comments:

Post a Comment