欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

七牛上传,报错 Could not resolve host: up.qiniu.com

程序员文章站 2022-04-28 17:13:09
...
错误代码:
Qiniu\Http\Errorresponse:
body: null
duration: 0.005
error: "Could not resolve host: up.qiniu.com"
headers: []
statusCode: -1
Qiniu\Http\Errorurl: "http://up.qiniu.com"

ping up.qiniu.com 能够ping通
ping up.qiniu.com
PING bc-gate-io.qiniu.com (106.38.227.29) 56(84) bytes of data.
64 bytes from 106.38.227.29: icmp_seq=1 ttl=50 time=161 ms
64 bytes from 106.38.227.29: icmp_seq=2 ttl=50 time=180 ms
64 bytes from 106.38.227.29: icmp_seq=3 ttl=50 time=180 ms
64 bytes from 106.38.227.29: icmp_seq=4 ttl=50 time=164 ms
64 bytes from 106.38.227.29: icmp_seq=5 ttl=50 time=167 ms
64 bytes from 106.38.227.29: icmp_seq=7 ttl=50 time=164 ms

这是为何呀?

回复内容:

错误代码:
Qiniu\Http\Errorresponse:
body: null
duration: 0.005
error: "Could not resolve host: up.qiniu.com"
headers: []
statusCode: -1
Qiniu\Http\Errorurl: "http://up.qiniu.com"

ping up.qiniu.com 能够ping通
ping up.qiniu.com
PING bc-gate-io.qiniu.com (106.38.227.29) 56(84) bytes of data.
64 bytes from 106.38.227.29: icmp_seq=1 ttl=50 time=161 ms
64 bytes from 106.38.227.29: icmp_seq=2 ttl=50 time=180 ms
64 bytes from 106.38.227.29: icmp_seq=3 ttl=50 time=180 ms
64 bytes from 106.38.227.29: icmp_seq=4 ttl=50 time=164 ms
64 bytes from 106.38.227.29: icmp_seq=5 ttl=50 time=167 ms
64 bytes from 106.38.227.29: icmp_seq=7 ttl=50 time=164 ms

这是为何呀?

dns 问题
解决方案:
vim /etc/resolvconf/resolv.conf.d/base
添加:
nameserver 8.8.8.8
nameserver 114.114.114.114

rm /etc/resolv.conf
ln -s ../run/resolvconf/resolv.conf /etc/resolv.conf
resolvconf -u

service networking restart
/etc/init.d/networking restart

修改本地DNS,修改为8.8.8.8或者114.114.114.114,试下是否可以正常上传;另外还可以在Qiniu\Config.php中,将UPLOAD_HOST修改为updx.qiniu.com,尝试下是否可以正常上传。

相关标签: php 七牛云存储