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                    [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
   "   from the digest: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to