PHP:get_headers为空结果

时间:2013-10-10 19:48:02

标签: php apache header get http-headers

我有一个脚本,用于检查该文件是否存在于get_headers的其他服务器上。我在一台服务器上运行了两台服务器,另一台我得到get_headers的空响应。

我的代码:

$myurl='http://stackoverflow.com/';
$header = get_headers($myurl);
print_r($header);

php版

PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug  6 2012 14:18:06) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

溶液:

不确定它是什么,我的apache日志充满了这些错误 failed to open stream: php_network_getaddresses: getaddrinfo failed: System error

重新启动后,它全部消失,get_headers现在正在运行。

1 个答案:

答案 0 :(得分:0)

检查allow_url_fopen是否已打开。

  

php --info | grep allow_url_fopen