Getting null for $ _SERVER ['AUTH_USER']

I have a PHP application running on a Windows 2008 R2 server that authenticates users in Active Directory using the PHP LDAP library.

Like this answer , I am looking to use $_SERVER['AUTH_USER'] , but I get an empty value for it. The same goes for AUTH_TYPE and AUTH_PASSWORD . Variables are declared, but none of them has any meaning for them.

I enabled the Basic Authentication and Windows Authentication roles (through the server manager), but none of them solved the problem.

I am using PHP 5.3.14, Zend Server CE and IIS 7.5.

I need to apply a solution with one sign, but, not being able to get the current user credentials, I lose.

Any help would be greatly appreciated.

+4
source share
3 answers

I started by disabling anonymous authentication in IIS and enabling Windows authentication (I thought that Windows Authentication was already enabled, but it turns out that the role was just installed.) Now $_SERVER['AUTH_USER'] and $_SERVER['REMOTE_USER'] .

+8
source

I believe the correct index for the authenticated user is $_SERVER['REMOTE_USER'] .

+2
source

According to the PHP documentation , the correct index seems to be PHP_AUTH_USER .

Try using $_SERVER['PHP_AUTH_USER'] .

+1
source

All Articles