Getting blank value for $_SERVER['AUTH_USER']

后端 未结 3 1866
星月不相逢
星月不相逢 2021-02-20 11:59

I have a PHP app running on Windows 2008 server R2, which authenticates users against Active Directory using PHP\'s LDAP library.

As per this answer, I\'m looking to use

相关标签:
3条回答
  • 2021-02-20 12:09

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

    0 讨论(0)
  • 2021-02-20 12:29

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

    Try using $_SERVER['PHP_AUTH_USER'].

    0 讨论(0)
  • 2021-02-20 12:30

    I got it working by disabling Anonymous Authentication in IIS, and enabling Windows Authentication (I thought Windows Authentication was already enabled, but it turns out the role was simply installed.) Now $_SERVER['AUTH_USER'] and $_SERVER['REMOTE_USER'] are populated.

    0 讨论(0)
提交回复
热议问题