|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-01-15 07:31 UTC] azevedo at tchelinux dot com dot br
Hi, I've made a script to connect using fsockopen() (not pfsockopen()), and check the timeout into while. If the connection got a time out, I close the socket and restart the request again. The problem is that when I got some network problem that made the connection to be lost, the PHP script simple doesn't close this socket with fclose() and when I open the socket again, I can't send or receive any data. The script is running at shell, and is fetching many web pages to insert into a mysql database. All works fine, till I got any network problem. I've searched all the documentation and bug reports and there's nothing talking about the fclose() to not real close the socket. There's any other way to really force the socket to be closed and oppened again in the same script? Thanks in advice. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 17:00:01 2025 UTC |
I am running PHP 4.3, RedHat Linux 7.3, Apache-1.3.27-2 and have still the problem : 1-$fp = fsockopen ($tiphost[$i],25,&$errno,&$errstr,&$TimeOut); 2-$tstatus = stream_get_meta_data ($fp); 3-if ($tstatus["eof"]) { 4- $output = '114 Connection unexpectedly closed'; 5-} 6-$err = fclose ($fp); At line 6 it goes (sometimes) wrong, I guess for the same reason as described here and I get Apache PIDs running for days now... I tried set_time_limit () but as fclose() is "out" of PHP (I think) it does not make the job :-( /server-status gives for example : M CPU SS Req K 34.48 74295 280513 which means the server child is in Keepalive mode, used 34.48 secs of CPU (stalled), not working for 74295 secs (growing), and have been working for 280513 secs (stalled)