Rumah >pembangunan bahagian belakang >tutorial php >七牛上传,报错 Could not resolve host: up.qiniu.com

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

WBOY
WBOYasal
2016-06-06 20:34:402631semak imbas

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

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn