php_network_getaddresses:getaddrinfo failed:名称或服务未知

时间:2017-11-15 15:40:53

标签: php networkx

我的代码:

php -r 'var_dump(file_get_contents("http://ssmss.ir"));'

效果很好

我的服务器在centos 7命令行中有ping和internet以及连接

这是使用linux curl命令行调用url的示例:

 Connected to ​172.x.x.x(172.x.x.x) port 8085 (#0)
 GET /sms/getid?mid=1 HTTP/1.1
 User-Agent: curl/7.29.0
 Host: 172.x.x.x:8085
 Accept: */*

 HTTP/1.1 200 OK
 Server: Oracle XML DB/Oracle Database
 Content-Type: text/xml; charset=UTF-8
 Content-Length: 70

 <?xml version="1.0"?>

但是当我使用php连接到这个网址时,它说:

file_get_contents(http://​172.x.x.x:8085/sms/getid?mid=1): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in - on line 1

我尝试使用所有选项卷曲,但它也不起作用

我能做什么?

非常重要

这是我在发送此问题之前使用的其他一些命令:

[root@localhost ~]# setsebool -P nis_enabled 1
setsebool:  SELinux is disabled.
[root@localhost ~]# setsebool -P httpd_can_network_connect 1
setsebool:  SELinux is disabled.
[root@localhost ~]# setsebool -P httpd_verify_dns=1
setsebool:  SELinux is disabled.
[root@localhost ~]# service nginx restart
Redirecting to /bin/systemctl restart nginx.service
[root@localhost ~]# service php-fpm restart
Redirecting to /bin/systemctl restart php-fpm.service
[root@localhost ~]# cat  /etc/resolv.conf
# Generated by NetworkManager
nameserver 8.8.8.8
nameserver 4.2.2.4

0 个答案:

没有答案