Professional Web Applications Themes

#39803 [NEW]: fsockopen() bug - PHP Programming

From: marcelo at tpn dot com dot br Operating system: FreeBSD 5.3 PHP version: 4.4.4 PHP Bug Type: Sockets related Bug description: fsockopen() bug Description: ------------ The function fsockopen() is always failing and returning -1. I already tried with differents hostnames and IP address. I'm using FreeBSD 5.3. Reproduce code: --------------- <?php $fp = fsockopen("www.google.com", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)\n"; } ?> Expected result: ---------------- $fp should be TRUE... Actual result: -------------- But... $fp is returning FALSE $errno is returning 36 $errstr is returning "Operation now in progress" -- Edit bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url] -- ...

  1. #1

    Default #39803 [NEW]: fsockopen() bug

    From: marcelo at tpn dot com dot br
    Operating system: FreeBSD 5.3
    PHP version: 4.4.4
    PHP Bug Type: Sockets related
    Bug description: fsockopen() bug

    Description:
    ------------
    The function fsockopen() is always failing and returning -1.

    I already tried with differents hostnames and IP address.

    I'm using FreeBSD 5.3.

    Reproduce code:
    ---------------
    <?php
    $fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
    if (!$fp) {
    echo "$errstr ($errno)\n";
    }
    ?>

    Expected result:
    ----------------
    $fp should be TRUE...

    Actual result:
    --------------
    But...

    $fp is returning FALSE
    $errno is returning 36
    $errstr is returning "Operation now in progress"

    --
    Edit bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    --
    Try a CVS snapshot (PHP 4.4): [url]http://bugs.php.net/fix.php?id=39803&r=trysnapshot44[/url]
    Try a CVS snapshot (PHP 5.2): [url]http://bugs.php.net/fix.php?id=39803&r=trysnapshot52[/url]
    Try a CVS snapshot (PHP 6.0): [url]http://bugs.php.net/fix.php?id=39803&r=trysnapshot60[/url]
    Fixed in CVS: [url]http://bugs.php.net/fix.php?id=39803&r=fixedcvs[/url]
    Fixed in release: [url]http://bugs.php.net/fix.php?id=39803&r=alreadyfixed[/url]
    Need backtrace: [url]http://bugs.php.net/fix.php?id=39803&r=needtrace[/url]
    Need Reproduce Script: [url]http://bugs.php.net/fix.php?id=39803&r=needscript[/url]
    Try newer version: [url]http://bugs.php.net/fix.php?id=39803&r=oldversion[/url]
    Not developer issue: [url]http://bugs.php.net/fix.php?id=39803&r=support[/url]
    Expected behavior: [url]http://bugs.php.net/fix.php?id=39803&r=notwrong[/url]
    Not enough info: [url]http://bugs.php.net/fix.php?id=39803&r=notenoughinfo[/url]
    Submitted twice: [url]http://bugs.php.net/fix.php?id=39803&r=submittedtwice[/url]
    register_globals: [url]http://bugs.php.net/fix.php?id=39803&r=globals[/url]
    PHP 3 support discontinued: [url]http://bugs.php.net/fix.php?id=39803&r=php3[/url]
    Daylight Savings: [url]http://bugs.php.net/fix.php?id=39803&r=dst[/url]
    IIS Stability: [url]http://bugs.php.net/fix.php?id=39803&r=isapi[/url]
    Install GNU Sed: [url]http://bugs.php.net/fix.php?id=39803&r=gnused[/url]
    Floating point limitations: [url]http://bugs.php.net/fix.php?id=39803&r=float[/url]
    No Zend Extensions: [url]http://bugs.php.net/fix.php?id=39803&r=nozend[/url]
    MySQL Configuration Error: [url]http://bugs.php.net/fix.php?id=39803&r=mysqlcfg[/url]
    marcelo at tpn dot com dot br Guest

  2. #2

    Default #39803 [Opn->Bgs]: fsockopen() bug

    ID: 39803
    Updated by: [email]tony2001@php.net[/email]
    Reported By: marcelo at tpn dot com dot br
    -Status: Open
    +Status: Bogus
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    Sorry, but your problem does not imply a bug in PHP itself. For a
    list of more appropriate places to ask for help using PHP, please
    visit [url]http://www.php.net/support.php[/url] as this bug system is not the
    appropriate forum for asking support questions. Due to the volume
    of reports we can not explain in detail here why your report is not
    a bug. The support channels will be able to provide an explanation
    for you.

    Thank you for your interest in PHP.

    Please consult your system administrator on how to disable the
    firewall.


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

    [2006-12-12 01:10:21] marcelo at tpn dot com dot br

    Description:
    ------------
    The function fsockopen() is always failing and returning -1.

    I already tried with differents hostnames and IP address.

    I'm using FreeBSD 5.3.

    Reproduce code:
    ---------------
    <?php
    $fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
    if (!$fp) {
    echo "$errstr ($errno)\n";
    }
    ?>

    Expected result:
    ----------------
    $fp should be TRUE...

    Actual result:
    --------------
    But...

    $fp is returning FALSE
    $errno is returning 36
    $errstr is returning "Operation now in progress"


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]

    tony2001@php.net Guest

  3. #3

    Default #39803 [Bgs]: fsockopen() bug

    ID: 39803
    User updated by: marcelo at tpn dot com dot br
    Reported By: marcelo at tpn dot com dot br
    Status: Bogus
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    Why socket_create() works and fsockopen() doesn't?

    If there is some wrong outside PHP, why just fsockopen fails?


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

    [2006-12-12 07:32:24] [email]tony2001@php.net[/email]

    Sorry, but your problem does not imply a bug in PHP itself. For a
    list of more appropriate places to ask for help using PHP, please
    visit [url]http://www.php.net/support.php[/url] as this bug system is not the
    appropriate forum for asking support questions. Due to the volume
    of reports we can not explain in detail here why your report is not
    a bug. The support channels will be able to provide an explanation
    for you.

    Thank you for your interest in PHP.

    Please consult your system administrator on how to disable the
    firewall.

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

    [2006-12-12 01:10:21] marcelo at tpn dot com dot br

    Description:
    ------------
    The function fsockopen() is always failing and returning -1.

    I already tried with differents hostnames and IP address.

    I'm using FreeBSD 5.3.

    Reproduce code:
    ---------------
    <?php
    $fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
    if (!$fp) {
    echo "$errstr ($errno)\n";
    }
    ?>

    Expected result:
    ----------------
    $fp should be TRUE...

    Actual result:
    --------------
    But...

    $fp is returning FALSE
    $errno is returning 36
    $errstr is returning "Operation now in progress"


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  4. #4

    Default #39803 [Bgs->Opn]: fsockopen() bug

    ID: 39803
    User updated by: marcelo at tpn dot com dot br
    Reported By: marcelo at tpn dot com dot br
    -Status: Bogus
    +Status: Open
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    More details:

    Using php-cgi, fsockopen works correctly.

    The build date of the PHP (Apache Module) and PHP-CGI is the same.


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

    [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?

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

    [2006-12-12 07:32:24] [email]tony2001@php.net[/email]

    Sorry, but your problem does not imply a bug in PHP itself. For a
    list of more appropriate places to ask for help using PHP, please
    visit [url]http://www.php.net/support.php[/url] as this bug system is not the
    appropriate forum for asking support questions. Due to the volume
    of reports we can not explain in detail here why your report is not
    a bug. The support channels will be able to provide an explanation
    for you.

    Thank you for your interest in PHP.

    Please consult your system administrator on how to disable the
    firewall.

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

    [2006-12-12 01:10:21] marcelo at tpn dot com dot br

    Description:
    ------------
    The function fsockopen() is always failing and returning -1.

    I already tried with differents hostnames and IP address.

    I'm using FreeBSD 5.3.

    Reproduce code:
    ---------------
    <?php
    $fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
    if (!$fp) {
    echo "$errstr ($errno)\n";
    }
    ?>

    Expected result:
    ----------------
    $fp should be TRUE...

    Actual result:
    --------------
    But...

    $fp is returning FALSE
    $errno is returning 36
    $errstr is returning "Operation now in progress"


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  5. #5

    Default #39803 [Opn->Bgs]: fsockopen() bug

    ID: 39803
    Updated by: [email]tony2001@php.net[/email]
    Reported By: marcelo at tpn dot com dot br
    -Status: Open
    +Status: Bogus
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    Both CGI and Apache module share the same code for fsockopen(), so
    fsockopen() doesn't depend on the Server API used.


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

    [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?

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

    [2006-12-12 07:32:24] [email]tony2001@php.net[/email]

    Sorry, but your problem does not imply a bug in PHP itself. For a
    list of more appropriate places to ask for help using PHP, please
    visit [url]http://www.php.net/support.php[/url] as this bug system is not the
    appropriate forum for asking support questions. Due to the volume
    of reports we can not explain in detail here why your report is not
    a bug. The support channels will be able to provide an explanation
    for you.

    Thank you for your interest in PHP.

    Please consult your system administrator on how to disable the
    firewall.

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

    [2006-12-12 01:10:21] marcelo at tpn dot com dot br

    Description:
    ------------
    The function fsockopen() is always failing and returning -1.

    I already tried with differents hostnames and IP address.

    I'm using FreeBSD 5.3.

    Reproduce code:
    ---------------
    <?php
    $fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
    if (!$fp) {
    echo "$errstr ($errno)\n";
    }
    ?>

    Expected result:
    ----------------
    $fp should be TRUE...

    Actual result:
    --------------
    But...

    $fp is returning FALSE
    $errno is returning 36
    $errstr is returning "Operation now in progress"


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    tony2001@php.net Guest

  6. #6

    Default #39803 [Bgs->Opn]: fsockopen() bug

    ID: 39803
    User updated by: marcelo at tpn dot com dot br
    Reported By: marcelo at tpn dot com dot br
    -Status: Bogus
    +Status: Open
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    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.


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

    [2006-12-12 14:22:58] [email]tony2001@php.net[/email]

    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?

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

    [2006-12-12 07:32:24] [email]tony2001@php.net[/email]

    Sorry, but your problem does not imply a bug in PHP itself. For a
    list of more appropriate places to ask for help using PHP, please
    visit [url]http://www.php.net/support.php[/url] as this bug system is not the
    appropriate forum for asking support questions. Due to the volume
    of reports we can not explain in detail here why your report is not
    a bug. The support channels will be able to provide an explanation
    for you.

    Thank you for your interest in PHP.

    Please consult your system administrator on how to disable the
    firewall.

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

    [2006-12-12 01:10:21] marcelo at tpn dot com dot br

    Description:
    ------------
    The function fsockopen() is always failing and returning -1.

    I already tried with differents hostnames and IP address.

    I'm using FreeBSD 5.3.

    Reproduce code:
    ---------------
    <?php
    $fp = fsockopen("www.google.com", 80, $errno, $errstr, 30);
    if (!$fp) {
    echo "$errstr ($errno)\n";
    }
    ?>

    Expected result:
    ----------------
    $fp should be TRUE...

    Actual result:
    --------------
    But...

    $fp is returning FALSE
    $errno is returning 36
    $errstr is returning "Operation now in progress"


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  7. #7

    Default #39803 [Opn->Fbk]: fsockopen() bug

    ID: 39803
    Updated by: [email]tony2001@php.net[/email]
    Reported By: marcelo at tpn dot com dot br
    -Status: Open
    +Status: Feedback
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:
    >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?


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

    [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]tony2001@php.net[/email]

    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?

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

    [2006-12-12 07:32:24] [email]tony2001@php.net[/email]

    Sorry, but your problem does not imply a bug in PHP itself. For a
    list of more appropriate places to ask for help using PHP, please
    visit [url]http://www.php.net/support.php[/url] as this bug system is not the
    appropriate forum for asking support questions. Due to the volume
    of reports we can not explain in detail here why your report is not
    a bug. The support channels will be able to provide an explanation
    for you.

    Thank you for your interest in PHP.

    Please consult your system administrator on how to disable the
    firewall.

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    tony2001@php.net Guest

  8. #8

    Default #39803 [Fbk->Opn]: fsockopen() bug

    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 [url]www.google.com[/url]
    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]tony2001@php.net[/email]
    >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]tony2001@php.net[/email]

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  9. #9

    Default #39803 [Opn->Fbk]: fsockopen() bug

    ID: 39803
    Updated by: [email]tony2001@php.net[/email]
    Reported By: marcelo at tpn dot com dot br
    -Status: Open
    +Status: Feedback
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    Does the fix from [url]http://bugs.php.net/bug.php?id=38568[/url] work for you?


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

    [2006-12-12 16:19:34] marcelo at tpn dot com dot br

    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 [url]www.google.com[/url]
    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".

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

    [2006-12-12 15:42:40] [email]tony2001@php.net[/email]
    >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]tony2001@php.net[/email]

    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.

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]

    tony2001@php.net Guest

  10. #10

    Default #39803 [Fbk->Opn]: fsockopen() bug

    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:

    I'm using PHP 4.4.4, not PHP 5.

    network.c has two pieces that uses EINPROGRESS:

    if ((n = connect(sockfd, addr, addrlen)) < 0) {
    if (errno != EINPROGRESS) {
    return -1;
    }
    }

    if (ret == -1 && error == EINPROGRESS) {
    error = 0;
    goto retry_again;
    }

    Where should I put "if (error == EINPROGRESS) error = 0;" ?


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

    [2006-12-12 16:32:18] [email]tony2001@php.net[/email]

    Does the fix from [url]http://bugs.php.net/bug.php?id=38568[/url] work for you?

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

    [2006-12-12 16:19:34] marcelo at tpn dot com dot br

    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 [url]www.google.com[/url]
    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".

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

    [2006-12-12 15:42:40] [email]tony2001@php.net[/email]
    >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]tony2001@php.net[/email]

    Both CGI and Apache module share the same code for fsockopen(), so
    fsockopen() doesn't depend on the Server API used.

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  11. #11

    Default #39803 [Opn->Fbk]: fsockopen() bug

    ID: 39803
    Updated by: [email]tony2001@php.net[/email]
    Reported By: marcelo at tpn dot com dot br
    -Status: Open
    +Status: Feedback
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    Please provide more information on how to reproduce it or an account on
    this machine.


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

    [2006-12-12 17:43:15] marcelo at tpn dot com dot br

    I'm using PHP 4.4.4, not PHP 5.

    network.c has two pieces that uses EINPROGRESS:

    if ((n = connect(sockfd, addr, addrlen)) < 0) {
    if (errno != EINPROGRESS) {
    return -1;
    }
    }

    if (ret == -1 && error == EINPROGRESS) {
    error = 0;
    goto retry_again;
    }

    Where should I put "if (error == EINPROGRESS) error = 0;" ?

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

    [2006-12-12 16:32:18] [email]tony2001@php.net[/email]

    Does the fix from [url]http://bugs.php.net/bug.php?id=38568[/url] work for you?

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

    [2006-12-12 16:19:34] marcelo at tpn dot com dot br

    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 [url]www.google.com[/url]
    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".

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

    [2006-12-12 15:42:40] [email]tony2001@php.net[/email]
    >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.

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    tony2001@php.net Guest

  12. #12

    Default #39803 [Fbk->Opn]: fsockopen() bug

    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:

    Can I send the account information to [email]tony2001@php.net[/email] for privacy?


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

    [2006-12-13 10:09:48] [email]tony2001@php.net[/email]

    Please provide more information on how to reproduce it or an account on
    this machine.

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

    [2006-12-12 17:43:15] marcelo at tpn dot com dot br

    I'm using PHP 4.4.4, not PHP 5.

    network.c has two pieces that uses EINPROGRESS:

    if ((n = connect(sockfd, addr, addrlen)) < 0) {
    if (errno != EINPROGRESS) {
    return -1;
    }
    }

    if (ret == -1 && error == EINPROGRESS) {
    error = 0;
    goto retry_again;
    }

    Where should I put "if (error == EINPROGRESS) error = 0;" ?

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

    [2006-12-12 16:32:18] [email]tony2001@php.net[/email]

    Does the fix from [url]http://bugs.php.net/bug.php?id=38568[/url] work for you?

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

    [2006-12-12 16:19:34] marcelo at tpn dot com dot br

    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 [url]www.google.com[/url]
    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".

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

    [2006-12-12 15:42:40] [email]tony2001@php.net[/email]
    >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?

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  13. #13

    Default #39803 [Opn->Fbk]: fsockopen() bug

    ID: 39803
    Updated by: [email]tony2001@php.net[/email]
    Reported By: marcelo at tpn dot com dot br
    -Status: Open
    +Status: Feedback
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    Sure.


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

    [2006-12-13 13:13:10] marcelo at tpn dot com dot br

    Can I send the account information to [email]tony2001@php.net[/email] for privacy?

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

    [2006-12-13 10:09:48] [email]tony2001@php.net[/email]

    Please provide more information on how to reproduce it or an account on
    this machine.

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

    [2006-12-12 17:43:15] marcelo at tpn dot com dot br

    I'm using PHP 4.4.4, not PHP 5.

    network.c has two pieces that uses EINPROGRESS:

    if ((n = connect(sockfd, addr, addrlen)) < 0) {
    if (errno != EINPROGRESS) {
    return -1;
    }
    }

    if (ret == -1 && error == EINPROGRESS) {
    error = 0;
    goto retry_again;
    }

    Where should I put "if (error == EINPROGRESS) error = 0;" ?

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

    [2006-12-12 16:32:18] [email]tony2001@php.net[/email]

    Does the fix from [url]http://bugs.php.net/bug.php?id=38568[/url] work for you?

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

    [2006-12-12 16:19:34] marcelo at tpn dot com dot br

    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 [url]www.google.com[/url]
    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".

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    tony2001@php.net Guest

  14. #14

    Default #39803 [Fbk->Opn]: fsockopen() bug

    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:

    Sent to [email]tony2001@php.net[/email].


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

    [2006-12-13 13:27:31] [email]tony2001@php.net[/email]

    Sure.

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

    [2006-12-13 13:13:10] marcelo at tpn dot com dot br

    Can I send the account information to [email]tony2001@php.net[/email] for privacy?

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

    [2006-12-13 10:09:48] [email]tony2001@php.net[/email]

    Please provide more information on how to reproduce it or an account on
    this machine.

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

    [2006-12-12 17:43:15] marcelo at tpn dot com dot br

    I'm using PHP 4.4.4, not PHP 5.

    network.c has two pieces that uses EINPROGRESS:

    if ((n = connect(sockfd, addr, addrlen)) < 0) {
    if (errno != EINPROGRESS) {
    return -1;
    }
    }

    if (ret == -1 && error == EINPROGRESS) {
    error = 0;
    goto retry_again;
    }

    Where should I put "if (error == EINPROGRESS) error = 0;" ?

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

    [2006-12-12 16:32:18] [email]tony2001@php.net[/email]

    Does the fix from [url]http://bugs.php.net/bug.php?id=38568[/url] work for you?

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  15. #15

    Default #39803 [Opn]: fsockopen() bug

    ID: 39803
    User updated by: marcelo at tpn dot com dot br
    Reported By: marcelo at tpn dot com dot br
    Status: Open
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    Did you receive my e-mail?


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

    [2006-12-13 14:30:38] marcelo at tpn dot com dot br

    Sent to [email]tony2001@php.net[/email].

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

    [2006-12-13 13:27:31] [email]tony2001@php.net[/email]

    Sure.

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

    [2006-12-13 13:13:10] marcelo at tpn dot com dot br

    Can I send the account information to [email]tony2001@php.net[/email] for privacy?

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

    [2006-12-13 10:09:48] [email]tony2001@php.net[/email]

    Please provide more information on how to reproduce it or an account on
    this machine.

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

    [2006-12-12 17:43:15] marcelo at tpn dot com dot br

    I'm using PHP 4.4.4, not PHP 5.

    network.c has two pieces that uses EINPROGRESS:

    if ((n = connect(sockfd, addr, addrlen)) < 0) {
    if (errno != EINPROGRESS) {
    return -1;
    }
    }

    if (ret == -1 && error == EINPROGRESS) {
    error = 0;
    goto retry_again;
    }

    Where should I put "if (error == EINPROGRESS) error = 0;" ?

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  16. #16

    Default #39803 [Opn]: fsockopen() bug

    ID: 39803
    User updated by: marcelo at tpn dot com dot br
    Reported By: marcelo at tpn dot com dot br
    Status: Open
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    Someone else can help me to fix this bug?


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

    [2006-12-14 13:28:18] marcelo at tpn dot com dot br

    Did you receive my e-mail?

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

    [2006-12-13 14:30:38] marcelo at tpn dot com dot br

    Sent to [email]tony2001@php.net[/email].

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

    [2006-12-13 13:27:31] [email]tony2001@php.net[/email]

    Sure.

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

    [2006-12-13 13:13:10] marcelo at tpn dot com dot br

    Can I send the account information to [email]tony2001@php.net[/email] for privacy?

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

    [2006-12-13 10:09:48] [email]tony2001@php.net[/email]

    Please provide more information on how to reproduce it or an account on
    this machine.

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    marcelo at tpn dot com dot br Guest

  17. #17

    Default #39803 [Opn->Fbk]: fsockopen() bug

    ID: 39803
    Updated by: [email]tony2001@php.net[/email]
    Reported By: marcelo at tpn dot com dot br
    -Status: Open
    +Status: Feedback
    Bug Type: Sockets related
    Operating System: FreeBSD 5.3
    PHP Version: 4.4.4
    New Comment:

    I really doubt I can reproduce or investigate it with only an FTP
    account. When I said "account on this machine" I meant SSH access.


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

    [2006-12-18 17:03:42] marcelo at tpn dot com dot br

    Someone else can help me to fix this bug?

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

    [2006-12-14 13:28:18] marcelo at tpn dot com dot br

    Did you receive my e-mail?

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

    [2006-12-13 14:30:38] marcelo at tpn dot com dot br

    Sent to [email]tony2001@php.net[/email].

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

    [2006-12-13 13:27:31] [email]tony2001@php.net[/email]

    Sure.

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

    [2006-12-13 13:13:10] marcelo at tpn dot com dot br

    Can I send the account information to [email]tony2001@php.net[/email] for privacy?

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

    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
    [url]http://bugs.php.net/39803[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=39803&edit=1[/url]
    tony2001@php.net Guest

Similar Threads

  1. Replies: 6
    Last Post: March 2nd, 04:34 PM
  2. Replies: 0
    Last Post: July 24th, 06:12 PM
  3. Replies: 0
    Last Post: July 24th, 06:10 PM
  4. Replies: 0
    Last Post: July 24th, 08:45 AM
  5. Replies: 0
    Last Post: July 24th, 02:15 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139