Current time: 12-23-2024, 10:24 AM Hello There, Guest! (LoginRegister)


Post Reply 
FastCGI + PHP + HTTP-AUTH
Author Message
Binford8000 Offline
Junior Member
*

Posts: 24
Joined: Jan 2008
Reputation: 0
Post: #1
FastCGI + PHP + HTTP-AUTH
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;
    }


(This post was last modified: 02-05-2008 08:36 AM by Binford8000.)
02-05-2008 05:47 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #2
RE: FastCGI + PHP + HTTP-AUTH
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
02-05-2008 07:28 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Binford8000 Offline
Junior Member
*

Posts: 24
Joined: Jan 2008
Reputation: 0
Post: #3
RE: FastCGI + PHP + HTTP-AUTH
That does not work. (for me)
02-05-2008 07:45 AM
Find all posts by this user Quote this message in a reply
joximu Offline
helper
*****
Moderators

Posts: 7,024
Joined: Jan 2007
Reputation: 92
Post: #4
RE: FastCGI + PHP + HTTP-AUTH
Ok, thanx.

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

/J
02-05-2008 07:57 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)