What is the best way to get the HTTP-authenticated user-name to ensure full portability across different web servers (Apache, IIS, Nginx, etc.)?
My understanding is that $_SERVER['REMOTE_USER']
is the CGI standard, but is it safe to assume that all web servers support this?
There are at least two other variants: $_SERVER['PHP_AUTH_USER']
on Apache and $_SERVER['AUTH_USER']
on IIS. Why do these server-specific variants exist if $_SERVER['REMOTE_USER']
is the correct variable to use?
Related thread, which only covers IIS/Coldfusion, not */PHP: Difference between AUTH_USER and REMOTE_USER cgi variables