HTTP authentication ot working?

Discussion in 'PHP' started by Michau, Dec 6, 2005.

  1. #1
    I created a script that uses simple HTTP authentication. I just copied the sample code from PHP documentation and modified it slightly. It works very well on my server, and on most clients' websitesm but about 10% of the people complain that it doesn't work. I checked on one of their servers and it simply turns out that $_SERVER["PHP_AUTH_*"] variables are never set, reagrdless on what was entered in the browser. Do you know what can cause this?
     
    Michau, Dec 6, 2005 IP
  2. garysims

    garysims Well-Known Member

    Messages:
    287
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Could it have something to do with the version of PHP? Superglobals such as $_GET , $_POST, and $_SERVER, etc. have only been available since PHP 4.1.0.
     
    garysims, Dec 6, 2005 IP
  3. boccio

    boccio Peon

    Messages:
    82
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Did you try something like:
    
    if (@phpversion() < '4.1.0') {
        $_FILE = $HTTP_POST_FILES;
        $_GET = $HTTP_GET_VARS;
        $_POST = $HTTP_POST_VARS;
        // etc...
    }
    
    PHP:
     
    boccio, Dec 6, 2005 IP
  4. Michau

    Michau Well-Known Member

    Messages:
    188
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #4
    Not, it's not on old versions of PHP, its't the opposite - the problem apperas on newest versions! I had seen this on various webhosts, most of them have no problem but on sume it's just plain not working, and I did verify that PHP version is above 4.1.0. Could it be a problem with server configuration?
     
    Michau, Jan 3, 2006 IP
  5. tccoder

    tccoder Peon

    Messages:
    69
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes have u tried it on a different server?

    download easyphp its free and it will let u run a server locally.. then u can test it and see if it has errors there too
     
    tccoder, Jan 3, 2006 IP