file_get_contents(): php_network_getaddresses: getaddrinfo failed

后端 未结 3 2423
青春惊慌失措
青春惊慌失措 2021-02-19 21:07

I\'m trying to update some values from one server to another server with a cron job. I use file_get_contents().

The strange thing is that this fails occasionally. One min

3条回答
  •  再見小時候
    2021-02-19 21:41

    The name lookup appears to fail whilst running within a cron job sometimes. I've only seen it with names in /etc/hosts, but I haven't tested DNS names.

    I was seeing it with sending email and SMTP connection timeouts.

    I don't know the exact cause, but in my case I got my SMTP code to connect to 127.0.0.1 instead of localhost and the problem went away.

提交回复
热议问题