In my .htaccess file, I have:
AuthType Basic
AuthName "Restricted Area"
AuthUserFile /path/to/.htpasswd
require valid-user
<Files .htaccess>
deny from all
</Files>
and the .htpasswd file has a valid user/password.
When I go to a PHP file, I need to get the username that was used to access the page. The PHP is accessed ok, so I know the user/pass are working, but I can't seem to get the username extracted.
I have tried both $_SERVER['REMOTE_USER'] and $_SERVER['PHP_AUTH_USER'], but both are empty. How can I make this work?