Hello is possible HTTP authentication with PHP on Static/CGI/PHP application? this does not work for me http://www.php.net/manual/en/features.http-auth.php Regards asked 28 Jan '12, 11:20 makeen |
The main HTTP authentication examples in the PHP documentation don't work on our servers because we use php-cgi to serve your PHP sites. The common workarounds for that problem involve setting a So, the solution is the pass the HTTP:Authentication header to your PHP script via some other means. Here is a solution that should work (adapted from HTTP AUTHENTICATION WITH PHP-CGI), by passing the authentication info as a URL parameter via mod_rewrite: First, add the following to
Then, in
Note that in the above example, we're simply accepting the authentication credentials and displaying the username. In practice, you'll obviously want to verify the authentication credentials via whatever mechanism suits you. Hope that helps!
permanent link
This answer is marked "community wiki".
answered 28 Jan '12, 18:13 seanf Thanks, this worked perfectly for me!
(21 Feb '12, 04:37)
Fredrik
|