OK, here's the situation. I'm running PHP5 (ISAPI) on Windows server 2K3 with IIS6 and I'm trying to access the HTTP authentication variables for use the Scuttle (a del.icio.us clone). After getting undefined index errors when using the $_SERVER['PHP_AUTH_USER'] variable, I found that these are not always supported in IIS. I've read through the manual and discussion at http://us3.php.net/features.http-auth and I've followed all of the instructions I can find there:
1) Set the cgi.rfc2616_headers = 0
2) Turned off all authentication for the site and enabled only anonymous access
3) Set the custom error messages for the 401 errors to standard.
I then tried using the code snippet recommended by the manual to obtain the user and password
list($user, $pw) = explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
With this I get an error that HTTP_AUTHORIZATION is an undefined index. I then tried using just the $HTTP_AUTHORIZATION instead of the server variable. Again no joy. So then I output the entire HTTP header string with
echo($_SERVER['ALL_HTTP'])
There was no AUTHORIZATION variables in there at all. The response I got was
HTTP_CONNECTION:keep-alive HTTP_KEEP_ALIVE:300 HTTP_ACCEPT:text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 HTTP_ACCEPT_CHARSET:ISO-8859-1,utf-8;q=0.7,*;q=0.7 HTTP_ACCEPT_ENCODING:gzip,deflate HTTP_ACCEPT_LANGUAGE:en-us,en;q=0.5 HTTP_COOKIE:PHPSESSID=440paln36pal26ifbooq8cpvp7; ASPSESSIONIDSQCTCSBA=NNKNLHHBPAEAGABNJEBHIILC; ASPSESSIONIDSQDRAQCA=NOKIOJBDDGODOCLMOFDJAFLK; ASPSESSIONIDQQCQBRDB=FPHAHIODDPLJEOJPLNMBNLFI HTTP_HOST:dev.ccswcd.com HTTP_USER_AGENT:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6
I should mention that I'm accessing the URL with the http://user:password@site.com format.
Does anyone have suggestions on what to do? It seems to me that the php documentation is out of date and that some of the variables are no longer available, at least on IIS6. I'd love to get some help.
Nate Baxley