How can I access the apache basic-auth username in a PHP script?
Simply access this variable:
$_SERVER['PHP_AUTH_USER']