httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Neil A. Hillard" <neil.hill...@agustawestland.com>
Subject Re: [users@httpd] How to get REMOTE_USER?
Date Tue, 24 Apr 2007 08:18:20 GMT
Hi,

Buffalo Dickens wrote:
> Dear all, I am eager to know how to get the environment variable
> REMOTE_USER of apache 2.
> 
> For example, I wrote this php file,
> <html>
>  <head>
>      <title>hello</title>
>  </head>
> 
>  <body>
>      <h1>
>          Hello, <?php echo( $_SERVER[ REMOTE_USER ] ) ?>!
>      </h1>
>  </body>
> </html>
> 
> However, it just sent output like this, "Hello, !". I don't know why.
> Actually, php work fine with apache in my system, which can be
> demonstrated by phpinfo() function. So, is it necessary for me to
> create files like .htaccess or .htpasswd in order to make my getting
> REMOTE_USER right? It seems that there is no REMOTE_USER in my system.

You need to tell Apache to authenticate the user.  Take a look at:

http://httpd.apache.org/docs/2.2/howto/auth.html

You should also use:

echo $_SERVER['REMOTE_USER']

ensuring you quote the index, see the 'Array do's and don'ts' at:

http://www.php.net/manual/en/language.types.array.php

HTH,


				Neil.

-- 
Neil Hillard                    neil.hillard@agustawestland.com
AgustaWestland                  http://www.whl.co.uk/

Disclaimer: This message does not necessarily reflect the
            views of Westland Helicopters Ltd.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message