How can I get the authenticated user name under Apache using plain HTTP authentication and PHP?

PhpApacheAuthenticationHttp Authentication

Php Problem Overview


First, let's get the security considerations out of the way. I'm using simple authentication under Apache for a one-off, internal use only, non-internet connected LAN, PHP web app.

How can get I the HTTP authenticated user name in PHP?

Php Solutions


Solution 1 - Php

I think that you are after this

$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbasszeroView Question on Stackoverflow
Solution 1 - PhpTeifionView Answer on Stackoverflow