当前位置:Gxlcms > PHP教程 > 七牛上传,报错Couldnotresolvehost:up.qiniu.com

七牛上传,报错Couldnotresolvehost:up.qiniu.com

时间:2021-07-01 10:21:17 帮助过:46人阅读

错误代码:
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,尝试下是否可以正常上传。

人气教程排行