|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-07-25 07:08 UTC] sheep at fearthisclan dot com
When I try to connect to a port on a server that isn't reachable or the packets are dropped the timeout doesn't work...
This worked when I was using PHP 4.0.4pl1
#!/usr/local/bin/php
<?php
echo "opening socket... \n";
fsockopen("microsoft.com", 12, $errno, $errstr, 5.0);
echo "$errno\n$errstr\n";
echo "done!\n";
?>
I have also tried this on a Red Hat 7.1 machine and it's just the samee there...
My configure line: './configure' '--with-zlib-dir=/usr/lib' '--with-png-dir=/usr/local/lib' '--with-gd=/usr/local' '--with-ttf=/software/freetype' '--with-apxs=/software/web/bin/apxs' '--with-mysql=/software/mysql/'
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 20:00:01 2025 UTC |
I'm using PHP 4.3.3 on FreeBSD and also have problems with this fsockopen It seams that no timeout is using, because simple script takes about 1 minute to finish with error. $fp = @fsockopen ('www.damirjosar.com', 80, $errno, $errstr, 1.0); print_r($errno); print_r($errstr); print_r($fp); Error is: 22 Invalid argument And it takes about 1 minute. What about 1.0 second I set. If i use regular system call like dig or nslookup It only takes about 10s for this host. I have same problems with function checkdnsrr and gethostbynameTry adjusting the default_socket_timeout ini setting, which defaults to 60 seconds. ini_set('default_socket_timeout', 10); fsockopen(...); (I know you shouldn't need to do this, but it will help me to figure out what is going on)Hello. I'm experiencing same problems with PHP 4.3.4 for Win32. ======== | CODE | ======== $socket = fsockopen($ip, $port, &$errno, &$errstr, 5); stream_set_blocking($socket, FALSE ); stream_set_timeout($socket, 5); fputs($socket, $request); $html = ""; while (!feof($socket)) { $html = $html.fgets($socket, 128); } fclose($socket); ========== | Result | ========== I got a fatal error after 30 seconds of running. I tried even 600 seconds in max_execution_time and have no luck - still have the same error. Looks like script hangs up while connecting to non-existent port on remote host. PS: Notice that i'm using only IP-addresses to connect, no hostnames! So the problem not in DNS-resolving.