Show us your full code here, so we can make sure you have left out nothing.
If you feel those vars aren't global, use "global $PHP_AUTH_USER" to make them global and see if that works :-)
Perhaps it is an apache settings... maybe something to do with htaccess priviledges? I know it shouldn't matter, but it never hurts to try.
-sridhar