首頁 >後端開發 >php教程 >七牛上传,报错 Could not resolve host: up.qiniu.com

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

WBOY
WBOY原創
2016-06-06 20:34:402630瀏覽

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

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn