ispCP - Board - Support
FastCGI + PHP + HTTP-AUTH - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Contributions Area (/forum-40.html)
+--- Forum: Howtos (/forum-41.html)
+--- Thread: FastCGI + PHP + HTTP-AUTH (/thread-2306.html)



FastCGI + PHP + HTTP-AUTH - Binford8000 - 02-05-2008 05:47 AM

It requires some changes in your PHP-Script and the fastcgi_ispcp.conf to get it to work.

- open /etc/apache2/mods-enabled/fastcgi_ispcp.conf
- add "-pass-header AUTHORIZATION" behind all this stuff of FastCgiConfig.
- restart/reload Apache

Now edit your Auth-Script and enhance it with this code: http://textsnippets.com/posts/show/312

PHP Code:
/**
 * Get HTTP Auth to work with PHP+FastCGI
 *
 * @author  Jacques Marneweck <jacques@php.net>
 * @license PHP License v3.01
 */

/**
 * Get HTTP Auth to work with PHP+FastCGI
 */

    

if (isset($_SERVER["AUTHORIZATION"]) && !empty($_SERVER["AUTHORIZATION"])) {

    list (
$type$cred) = split (" "$_SERVER['AUTHORIZATION']);

    if (
$type == 'Basic') {
        list (
$user$pass) = explode (":"base64_decode($cred));
        
$_SERVER['PHP_AUTH_USER'] = $user;
        
$_SERVER['PHP_AUTH_PW'] = $pass;
    }





RE: FastCGI + PHP + HTTP-AUTH - joximu - 02-05-2008 07:28 AM

There are slightly other examples

add "-pass-header HTTP_AUTHORIZATION" to the fastcgiconfig and then no modification in the php scripts should be needed...

I didn't test it...

/J


RE: FastCGI + PHP + HTTP-AUTH - Binford8000 - 02-05-2008 07:45 AM

That does not work. (for me)


RE: FastCGI + PHP + HTTP-AUTH - joximu - 02-05-2008 07:57 AM

Ok, thanx.

I have to also do some tests... - I'm sure we will have questions about this in near future...

/J