PHP Warning: fsockopen(): unable to connect (Connection timed out)


PHP Warning:fsockopen(): unable to connect to (Connection timed out) in /home/public_html/pinger.php on line 66

Error type: warning


You try to open a socket to a remote location, but your connection is timed out (you don’t receive any response).

Sample Code:

$fs = fsockopen($ping_host, $ping_port, $errno, $errstr);

if (is_resource($fs))
fwrite($fs, $http_request);
while (!feof($fs))
$response .= fgets($fs, 2048);


The host you are trying to connect to is either down or takes too long to respond (or from other reasons, you just can’t get a response).


Get a beer, watch a movie, play a game … really, there’s not much you can do usually. Wait a few minutes and try again. If you still get the same response check if there is any problem with your server (for example DNS problems), eventually contact your hosting provider.

Leave a Reply

Your email address will not be published. Required fields are marked *

Security question: * Time limit is exhausted. Please reload the CAPTCHA.