Skip to content
PHP Logo

What are the differences in retrieving user information between IIS and other web servers when using PHP?

When retrieving user information in PHP on IIS, the $_SERVER['REMOTE_USER'] variable may not be populated as it is on other web servers. To retrieve user information on IIS, you can use the $_SERVER['AUTH_USER'] variable instead.

php
$user = isset($_SERVER['REMOTE_USER']) ? $_SERVER['REMOTE_USER'] : (isset($_SERVER['AUTH_USER']) ? $_SERVER['AUTH_USER'] : null);