PHP application failed to connect after a network plugged back in
- by tntu
My data-center appears to have had some issues with their network and thus my server has suffered from on an off network connectivity for about an hour.
After the connection has been completely re-established my code still kept reporting the same issue over and over until I have restarted the service.
The code is a simple PHP code that loops forever checking the Apple feed-back server and then sleeps for a few minutes and then it begins all over again.
Now I understand the error being generated if the network is down but once it got back up why did it continue until I have restarted the code? Does PHP have something that needs to be re-initialized or something??
Messges log:
Dec 20 08:57:22 server kernel: r8169: eth0: link down
Dec 20 08:57:28 server kernel: r8169 0000:06:00.0: eth0: link up
Dec 20 08:57:29 server kernel: r8169: eth0: link down
Dec 20 08:57:33 server kernel: r8169 0000:06:00.0: eth0: link up
Dec 20 08:57:33 server kernel: r8169: eth0: link down
Dec 20 08:57:37 server kernel: r8169 0000:06:00.0: eth0: link up
Dec 20 08:57:38 server kernel: r8169: eth0: link down
Dec 20 08:57:44 server kernel: r8169 0000:06:00.0: eth0: link up
Dec 20 08:57:44 server kernel: r8169: eth0: link down
Dec 20 08:57:52 server kernel: r8169 0000:06:00.0: eth0: link up
Dec 20 08:57:52 server kernel: r8169: eth0: link down
Dec 20 09:10:58 server kernel: r8169 0000:06:00.0: eth0: link up
PHP Error:
PHP Warning: stream_socket_client(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/push/feedback.php on line 36
Code Line 36:
$apns = stream_socket_client('ssl://feedback.sandbox.push.apple.com:2196', $errcode, $errstr, 60, STREAM_CLIENT_CONNECT, $stream_context);