Can you get a Windows (AD) username in PHP?

authentication, php, windows

Solution

Check the `AUTH_USER` request variable. This will be empty if your web app allows anonymous access, but if your server's using basic or Windows integrated authentication, it will contain the username of the authenticated user.

In an Active Directory domain, if your clients are running Internet Explorer and your web server/filesystem permissions are configured properly, IE will silently submit their domain credentials to your server and `AUTH_USER` will be `MYDOMAIN\user.name` without the users having to explicitly log in to your web app.

Problem

I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible?

Original source