PHP cURL consistently taking 15s to resolve DNS

前端 未结 3 1938
遇见更好的自我
遇见更好的自我 2021-01-02 11:53

I\'m running PHP on a CentOS virtual machine under MacOS X, and any cURL request consistently takes 15s to run:

$c =          


        
3条回答
  •  青春惊慌失措
    2021-01-02 12:19

    With PHP 7.1.32 installed with brew on macos, I got exactly this problem. file_get_contents and curl do not use the same DNS.

    Like @schumyxp said, you can resolve manually first:

    BTW it's may be a good to force an IP instead of rely on a resolver.

提交回复
热议问题