ErrorException: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /data/wwwroot/fs-new-livechat/vendor/workerman/workerman/Connection/AsyncTcpConnection.php:190
一般在調(diào)用外部服務請求時候,有時由于配置問題無法訪問,php會報一個php_network_getaddresses: getaddrinfo failed: Name or servicenot known的錯誤:
原因: PHP主機連不上dns服務器導致
分析:比如你訪問請求的是 www.leyangjuntestxxxx.com的服務
你可以先:ping 或 telnet 下該域名看是否可以訪問,是否有響應
如果不能ping通說明你的服務現(xiàn)在連的是一個有問題的dns服務器
一般解決方法:
一:需要檢查請求的遠程主機是否在本機的/etc/hosts中
二:需要檢查防火墻的規(guī)則,是不是被響應攔截了
三:可以在/etc/hosts文件中手動綁定host
————————————————
原文鏈接:https://blog.csdn.net/leyangjun/article/details/78985128