php_network_getaddresses错误
2015-07-21 16:48:30   来源:   评论:0 点击:

php_network_getaddresses错误在使用 file_get_contents远程请求url时,出现警告:php_network_getaddresses: getaddrinfo failed: Nam

php_network_getaddresses错误
 

在使用 file_get_contents远程请求url时,出现警告:
php_network_getaddresses: getaddrinfo failed: Name or servicenot known
这个问题通常是由于 Apache/PHP主机连不上dns服务器,无法正常解析引起的问题

首先,要在命令行下检查,是否能ping通远程主机。

如果ping不通,那么你的name server(如果是fedora,在/etc/resolv.conf文件中)设置有问题。找一个可以使用的dns,用该dns的ip替换/etc/resolv.conf 中第一个nameserver的ip,然后重启apache。

也可以使用4.4.4.4和8.8.8.8

相关热词搜索:错误

上一篇:PHP生成静态html文件 的三种方法
下一篇:如何检测linux服务器是否支持curl测试

分享到: function postToWb(){ var _t = encodeURI(document.title); var _url = encodeURIComponent(document.location); var _appkey = encodeURI("cba3558104094dbaa4148d8caa436a0b"); var _pic = encodeURI(''); var _site = ''; var _u = 'https://v.t.qq.com/share/share.php?url='+_url+'&appkey='+_appkey+'&site='+_site+'&pic='+_pic+'&title='+_t; window.open( _u,'', 'width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no' ); } document.write(''); document.write(''); document.write(''); document.write(''); document.write(''); 收藏