Composer报错getaddrinfo failed: Name or service not known

Composer报错getaddrinfo failed: Name or service not known的解决办法。

详细错误:

[Composer\Downloader\TransportException]
The "https://repo.packagist.org/p/simple-swoole/skeleton.json" file could not be downloaded: php_network_getaddresses: getaddrinfo failed: Name or service not known
failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known

 

Composer报错getaddrinfo failed: Name or service not knownComposer报错getaddrinfo failed: Name or service not known

分析原因:

服务器DNS解析有误,用ping命令测试百度等网页,提示Name或Server not known。

解决办法:

设置服务器DNS地址为其他公共DNS,如:114.114.114.114

Linux系统的文件路径一般为/etc/resolv.conf,如果是宝塔面板也可以用Linux工具箱进行设置。

完成DNS设置后composer的错误就解决了。

 

Composer报错getaddrinfo failed: Name or service not known

波波
你想把广告放到这里吗?

发表评论

您必须 登录 才能发表留言!