Remote_Host 索引未显示

发布于 2024-12-21 04:41:25 字数 1281 浏览 0 评论 0原文

我们正在运行suse11 apache2.2服务器。 当我们尝试获取 REMOTE_HOST 时,我们收到错误“未找到索引”,如下所示

REMOTE_HOST : Notice: Undefined index: REMOTE_HOST in /media/nss/VOL1/htdocs/serverVars.php on line 44 

HTTP_REFERER : Notice: Undefined index: HTTP_REFERER in /media/nss/VOL1/htdocs/serverVars.php on line 45 

REMOTE_USER : Notice: Undefined index: REMOTE_USER in /media/nss/VOL1/htdocs/serverVars.php on line 46 

这是我们用来解决问题的示例。

<?php 
    print " BCIS serverVars.php " . "<br />";
    print "DOCUMENT_ROOT : ";   print  $_SERVER['DOCUMENT_ROOT'] . "<br />";
    print "SERVER_NAME   : ";   print $_SERVER['SERVER_NAME'] . "<br />";
    print "HTTP_HOST     : ";   print $_SERVER['HTTP_HOST'] . "<br />";
    print "HTTP_COOKIE     : "; print $_SERVER['HTTP_COOKIE'] . "<br />";

    print "----------------------------------------- <br />";

    print "REMOTE_HOST   : ";   print $_SERVER['REMOTE_HOST'] . "<br />";
    print "HTTP_REFERER  : ";   print $_SERVER['HTTP_REFERER'] . "<br />";
    print "REMOTE_USER   : ";   print $_SERVER['REMOTE_USER'] . "<br />";
    print "PATH_INFO     : ";   print $_SERVER['PATH_INFO'] . "<br />";
?>

有人可以指导我们走上正确的道路吗?

谢谢。

We are running suse11 apache2.2 server.
When we try to get REMOTE_HOST we get an error "index not found" as shown below

REMOTE_HOST : Notice: Undefined index: REMOTE_HOST in /media/nss/VOL1/htdocs/serverVars.php on line 44 

HTTP_REFERER : Notice: Undefined index: HTTP_REFERER in /media/nss/VOL1/htdocs/serverVars.php on line 45 

REMOTE_USER : Notice: Undefined index: REMOTE_USER in /media/nss/VOL1/htdocs/serverVars.php on line 46 

Here is a sample of what we are using to troubleshoot the problem.

<?php 
    print " BCIS serverVars.php " . "<br />";
    print "DOCUMENT_ROOT : ";   print  $_SERVER['DOCUMENT_ROOT'] . "<br />";
    print "SERVER_NAME   : ";   print $_SERVER['SERVER_NAME'] . "<br />";
    print "HTTP_HOST     : ";   print $_SERVER['HTTP_HOST'] . "<br />";
    print "HTTP_COOKIE     : "; print $_SERVER['HTTP_COOKIE'] . "<br />";

    print "----------------------------------------- <br />";

    print "REMOTE_HOST   : ";   print $_SERVER['REMOTE_HOST'] . "<br />";
    print "HTTP_REFERER  : ";   print $_SERVER['HTTP_REFERER'] . "<br />";
    print "REMOTE_USER   : ";   print $_SERVER['REMOTE_USER'] . "<br />";
    print "PATH_INFO     : ";   print $_SERVER['PATH_INFO'] . "<br />";
?>

Could someone direct us on the correct path?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

再见回来 2024-12-28 04:41:25

请参阅 $_SERVER["REMOTE_HOST"]< 上的手册/a>:

注意:您的 Web 服务器必须配置为创建此变量。例如,在 Apache 中,您需要 httpd.conf 中的 HostnameLookups On 才能使其存在。另请参阅 gethostbyaddr()

请注意,打开 HostnameLookups 可能会降低性能,因为 DNS 查找可能会占用大量资源。请参阅 有关 HostnameLookups 的 Apache 文档了解详情。

See the manual on $_SERVER["REMOTE_HOST"]:

Note: Your web server must be configured to create this variable. For example in Apache you'll need HostnameLookups On inside httpd.conf for it to exist. See also gethostbyaddr().

Note that turning HostnameLookups On can be bad for performance, as DNS lookups can be resource expensive. See the Apache documentation on HostnameLookups for details.

七婞 2024-12-28 04:41:25

根据 php.net

“您的 Web 服务器必须配置为创建此变量。例如,在 Apache 中,您需要在 httpd.conf 中使用 HostnameLookups On 才能使其存在。”

According to php.net:

"Your web server must be configured to create this variable. For example in Apache you'll need HostnameLookups On inside httpd.conf for it to exist."

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文