$_SERVER['PHP_AUTH_USER'] isn't available when using php as cgi 

$_SERVER['PHP_AUTH_USER'] isn't available when using php as cgi so we have to work with $_SERVER['REMOTE_USER']