#23131 [Opn]: If fsockopen can't open connection, if(!fp) doesn't run

From: Date: Wed, 09 Apr 2003 14:24:19 +0000
Subject: #23131 [Opn]: If fsockopen can't open connection, if(!fp) doesn't run
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37438@lists.php.net to get a copy of this message
 ID:               23131
 User updated by:  kangstarr at hotmail dot com
 Reported By:      kangstarr at hotmail dot com
 Status:           Open
 Bug Type:         Sockets related
 Operating System: Windows XP
 PHP Version:      4.3.1
 New Comment:

Ok, I forgot to note that I'm calling the php from another php.

index.php includes scastxml.php

scastxml.php is where the script is located.

When I go directly to scastxml.php the script works fine.  When I goto
index.php which includes the scastxml.php, the script only works if I
set the fsockopen timeout to 5 or less.  Can someone explain to me why
this happens??


Previous Comments:
------------------------------------------------------------------------

[2003-04-09 09:01:42] kangstarr at hotmail dot com

$fp = fsockopen("kang.kicks-ass.net", "8000", &$errno, &$errstr, 20);
//open connection
if(!$fp) {
   echo "No Connection";
   $success=2;  //set if no connection
}

Basically I'm checking to see if my SHOUTcast server is running.  If
the shoutcast server is not running, and it tries to open the
connection I get these html warnings.

Warning: fsockopen() [function.fsockopen]: php_hostconnect: connect
failed in e:\inetpub\wwwroot\scast\scastxml.php on line 37

Warning: fsockopen() [function.fsockopen]: unable to connect to
kang.kicks-ass.net:8000 in e:\inetpub\wwwroot\scast\scastxml.php on
line 37

Fatal error: Maximum execution time of 30 seconds exceeded in
e:\inetpub\wwwroot\scast\scastxml.php on line 37

I'm running WinXP, Apache 1.3, PHP 4.3.1

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=23131&edit=1



Thread (5 messages)

« previous php.bugs (#37438) next »