Remote_Host 索引未显示
我们正在运行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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
请参阅
$_SERVER["REMOTE_HOST"]
< 上的手册/a>:请注意,打开 HostnameLookups 可能会降低性能,因为 DNS 查找可能会占用大量资源。请参阅 有关
HostnameLookups
的 Apache 文档了解详情。See the manual on
$_SERVER["REMOTE_HOST"]
:Note that turning
HostnameLookups On
can be bad for performance, as DNS lookups can be resource expensive. See the Apache documentation onHostnameLookups
for details.根据 php.net:
According to php.net: