We help IT Professionals succeed at work.

Get Value of PHP_AUTH_USER

deharvy
deharvy asked
on
phpMyAdmin 2.6.4-pl3
MySQL 5.0

The following code isn't providing a value. I can't understand why:

$current_user = $_SERVER['PHP_AUTH_USER'];
printf( "Current User: %s<br>", $current_user);
Comment
Watch Question

CERTIFIED EXPERT

Commented:
If you are using PHP5.0 there is a known bug which means that PHP_AUTH_USER does not work

http://bugs.php.net/bug.php?id=29132

Do

<?php
phpinfo();
?>

and check the PHP version number

Author

Commented:
Thanks for this information.

Here is the version: PHP Version 4.4.7

Any other suggestions?
CERTIFIED EXPERT
Commented:
Look here - these are other things that upset PHP_AUTH_USER

http://www.faqts.com/knowledge_base/view.phtml/aid/30726
CERTIFIED EXPERT

Commented:
And this http://uk2.php.net/features.http-auth

I have assumed that you are running PHP as an Apache module, if not....... :-(

Author

Commented:
$current_user = $_SERVER['REMOTE_USER'];

Author

Commented:
After reviewing the article, this is what worked:

$current_user = $_SERVER['REMOTE_USER'];

Thanks for your help!

Explore More ContentExplore courses, solutions, and other research materials related to this topic.