Neel
Neel

Reputation: 547

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

How to get the HTTP authenticated user name in PHP?

Upvotes: 0

Views: 184

Answers (2)

Dean
Dean

Reputation: 6354

This is the answer you are looking for:

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

Upvotes: 1

Your Common Sense
Your Common Sense

Reputation: 157981

$_SERVER['REMOTE_USER'] if PHP run as an Apache module, and quite tricky with anything else

BTW, phpinfo() often helps with such matters

Upvotes: 0

Related Questions