php error file_get_contents()

piwik 放在服务器跑时,出现如下错误:

Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /usr/local/apache2/htdocs/heshun/kkk/zz.php on line 99
Warning: file_get_contents(http://www.php.net): failed to open stream: Invalid argument in /usr/local/apache2/htdocs/heshun/kkk/zz.php on line 99
to my surprise, when I log into my local net(BSD OS, PHP 4.3.10 ) and I run it by following:

google 了一把,检查如下问题:

1、检查 php.ini 的配置 allow_url_fopen 是否为 on

2、检查 dns 错误,直接在 /etc/resolve.conf 添加 dns 服务器即可。

比如:

#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
# Note: Manual change of this file disables netconfig too, but
# may get lost when this file contains comments or empty lines
# only, the netconfig settings are same with settings in this
# file and in case of a "netconfig update -f" call.
#
### Please remove (at least) this line when you modify the file!

nameserver 10.30.1.9
nameserver 10.30.1.10

 

 

你可能感兴趣的:(content)