无法从Web加载远程文件,但不能加载CLI

时间:2009-09-04 02:02:08

标签: php http apache httpd.conf

我可以从php CLI加载远程文件(http):

php > print_r(getimagesize("http://www.google.ca/intl/en_ca/images/logo.gif"));
Array
(
    [0] => 276
    [1] => 110
        [2] => 1
    [3] => width="276" height="110"
    [bits] => 8
    [channels] => 3
    [mime] => image/gif
)

然而,来自网络脚本的完全相同的代码给了我:

[Thu Sep 03 21:47:53 2009] [error] [client 127.0.0.1] PHP Warning:  getimagesize() [<a ref='function.getimagesize'>function.getimagesize</a>]: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/Whatsize/index.php on line 30
[Thu Sep 03 21:47:53 2009] [error] [client 127.0.0.1] PHP Warning:  getimagesize(http://www.google.ca/intl/en_ca/images/logo.gif) [<a href='function.getimagesize'>function.getimagesize</a>]: failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /var/www/html/Whatsize/index.php on line 30

我是否必须在httpd.conf中更改某些内容以允许远程文件访问?

1 个答案:

答案 0 :(得分:0)

我(暂时)至少通过重启httpd解决了这个问题。这似乎是一个漂浮了一段时间的错误。

http://www.scottklarr.com/topic/98/temporary-failure-in-name-resolution-in-php-script/

如果有人有更永久的解决方案,请回复。我的网络主机似乎没有这个问题,所以这对我来说是一个很好的解决方案。