标题:关于file_get_contents() 警告错误的解决方案 出处:BIWEB开源PHP WMS系统创始人ArthurXF肖飞的blog 时间:Tue, 05 Jun 2007 12:02:30 +0000 作者:ArthurXF 地址:http://www.bizeway.net/read.php/116.htm 内容: 最近服务器运行生成静态页面的程序,总是报错,错误信息如下: 引用 Warning:  file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: hostname nor servname provided, or not known in /data/www/vhost/5217u/plug-in/404/404.php on line 68 Warning:  file_get_contents(http://www.5217u.com/news/detail.php?id=6) [function.file-get-contents]: failed to open stream: Invalid argument in /data/www/vhost/5217u/plug-in/404/404.php on line 68 经查资料,发现错误是DNS的问题,域名无法解析,上服务器ping www.5217u.com得到错误信息,域名无法解析或者域名不存在,马上去查看resolv.conf,看到配置正确。 引用 domain  bizeway.com nameserver      202.96.209.5 nameserver      202.96.209.133 但是在服务器上ping www.5217u.com就是不正常解析,在本地ping可以正常解析,经朋友了解,上海电信的域名服务器做了调整,对一部分ip不提供DNS服务了,原来问题出在电信。 后将配置文件修改如下: 引用 domain  bizeway.com nameserver      202.96.209.133 nameserver      202.96.209.5 一切回复正常,希望大家以后再碰到“php_network_getaddresses: getaddrinfo failed: hostname nor servname provided”错误,不要动不动就去看程序哪里错了,换个DNS就好了。 Generated by Bo-blog 2.0.3 sp1