简体   繁体   English

Google Cloud PHP Curl超时

[英]Google Cloud PHP Curl timeout

I met this error sometimes on some CURL requests done (adding CURL options directly in the PHP like CURLOPT_TIMEOUT change nothing, and i use SDK for most of them...) : 有时我在完成某些CURL请求时遇到了此错误(直接在PHP中添加CURL选项(如CURLOPT_TIMEOUT)并没有改变,我大多数情况下都使用SDK ...):

Operation timed out after 0 milliseconds with 0 out of 0 bytes received

The "0 milliseconds" is always here, never more. “ 0毫秒”始终在此,不再存在。 Seems like an "internet down" and so, URL are unreachable. 好像是“互联网中断”,因此URL无法访问。

Any idea about a possible Google Cloud configuration to do maybe ? 关于可能要配置的Google Cloud的任何想法吗?

EDIT : in verbose mode i've got "Hostname was NOT found in DNS cache". 编辑:在详细模式下,我收到“在DNS缓存中未找到主机名”。 And then it reconnect again. 然后再次重新连接。

Thanks ! 谢谢 !

You can try to add these options to your CURL code: 您可以尝试将以下选项添加到CURL代码中:

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSLVERSION, 3);

These options were suggested on: cURL: Operation timed out after 0 milliseconds 这些选项在以下位置建议: cURL:操作在0毫秒后超时

Finally it was just the normal "error" before doing an update on the DNS cache. 最后,在进行DNS缓存更新之前,这只是正常的“错误”。 So CURL do the request then, can't access to the distant server because IP has changed and get "Hostname not found". 因此,CURL发出请求,由于IP更改而无法访问远程服务器,并获得“找不到主机名”。 Here, he get the new IP and doing again the request, with success. 在这里,他获得了新的IP,并成功地再次执行了请求。

So no issue ! 所以没问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM