ID: 39803
User updated by: marcelo at tpn dot com dot br
Reported By: marcelo at tpn dot com dot br
-Status: Feedback
+Status: Open
Bug Type: Sockets related
Operating System: FreeBSD 5.3
PHP Version: 4.4.4
New Comment:
Yes, I've disabled my firewall. I'm sure that isn't a firewall
problem.
The problem doesn't depend the hostname or IP address. I got the same
error trying to connect to localhost, 127.0.0.1, 10.0.0.9 (internal
network)
This also didn't work:
<?php
$fp = fsockopen("127.0.0.1", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)\n";
}
?>
This also didn't work (connect to an internal server):
<?php
$fp = fsockopen("10.0.0.9", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)\n";
}
?>
But I can use socket_connect without problems. Example:
<?
$sockHttp = socket_create(AF_INET, SOCK_STREAM, 0);
if (!$sockHttp) { die('socket_create() failed!'); }
$resSockHttp = socket_connect($sockHttp, "10.0.0.9", 80);
if (!$resSockHttp) { die('socket_connect() failed!'); }
?>
I also can use "fetch" utility to get data from these servers. I also
wrote a PERL script, and it worked.
I also type in prompt "telnet 127.0.0.1 80", "telnet www.google.com
80", the connection was sucessfull.
Only while I'm using fsockopen I got errors, always error returns 36
and error string returns "Operation now in progress".
Previous Comments:
------------------------------------------------------------------------
[2006-12-12 15:42:40] [EMAIL PROTECTED]
>I believe that if the code is the same, should produce the
> same result, else there is a bug.
No, it most likely means that it has nothing to do with this code and
you're looking for a problem in wrong place.
Have you already disabled your firewall?
------------------------------------------------------------------------
[2006-12-12 15:22:51] marcelo at tpn dot com dot br
I don't understand.
If worked with CGI but not as an Apache Module, why you don't consider
this a bug?
I believe that if the code is the same, should produce the same result,
else there is a bug.
------------------------------------------------------------------------
[2006-12-12 14:22:58] [EMAIL PROTECTED]
Both CGI and Apache module share the same code for fsockopen(), so
fsockopen() doesn't depend on the Server API used.
------------------------------------------------------------------------
[2006-12-12 14:10:09] marcelo at tpn dot com dot br
More details:
Using php-cgi, fsockopen works correctly.
The build date of the PHP (Apache Module) and PHP-CGI is the same.
------------------------------------------------------------------------
[2006-12-12 12:58:52] marcelo at tpn dot com dot br
Why socket_create() works and fsockopen() doesn't?
If there is some wrong outside PHP, why just fsockopen fails?
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/39803
--
Edit this bug report at http://bugs.php.net/?id=39803&edit=1