#40234 [NEW]: gethostbynamel always returns false when using PHP as CGI

Ask a Question related to PHP Bugs, Design and Development.

  1. #1

    Default #40234 [NEW]: gethostbynamel always returns false when using PHP as CGI

    From: silverbanana at gmx dot de
    Operating system: Windows XP SP2
    PHP version: 6CVS-2007-01-25 (snap)
    PHP Bug Type: Network related
    Bug description: gethostbynamel always returns false when using PHP as CGI

    Description:
    ------------
    gethostbynamel always returns false, instead of giving useful results.
    This is however only the case when I use PHP as CGI. gethostbynamel works
    as expected when I use PHP as Apache module and also when I use it from
    the command line, but not when I use it as CGI.

    If this behaviour of gethostbynamel is intended or unavoidable, it should
    be mentioned in the manual for gethostbynamel.

    Reproduce code:
    ---------------
    <?php
    var_dump(gethostbynamel("localhost"));
    ?>

    Expected result:
    ----------------
    List of addresses

    Actual result:
    --------------
    FALSE

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

  2. Similar Questions and Discussions

    1. [PHP-DEV] [PATCH] substr() returns false
      --=-sQWDp5Weadel0FX8XkrW Content-Type: text/plain Content-Transfer-Encoding: 7bit Hi, Even though this is documented, it is strange...
    2. mail() returns FALSE, no err msg
      Sometimes my mail() function returns FALSE, but there is no error message. Error reporting is set to E_ALL. It seems to be a problem of the bcc:...
    3. #24627 [Bgs]: feof always returns false
      ID: 24627 Updated by: sniper@php.net Reported By: duerra at yahoo dot com Status: Bogus Bug Type: ...
    4. #24627 [Opn->Bgs]: feof always returns false
      ID: 24627 Updated by: elmicha@php.net Reported By: duerra at yahoo dot com -Status: Open +Status: ...
    5. #24627 [Bgs->Opn]: feof always returns false
      ID: 24627 User updated by: duerra at yahoo dot com Reported By: duerra at yahoo dot com -Status: Bogus +Status: ...
  3. #2

    Default #40234 [Opn->Fbk]: gethostbynamel always returns false when using PHP as CGI

    ID: 40234
    Updated by: [email]tony2001@php.net[/email]
    Reported By: silverbanana at gmx dot de
    -Status: Open
    +Status: Feedback
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]




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

    [2007-01-25 11:42:39] silverbanana at gmx dot de

    Description:
    ------------
    gethostbynamel always returns false, instead of giving useful results.
    This is however only the case when I use PHP as CGI. gethostbynamel
    works as expected when I use PHP as Apache module and also when I use
    it from the command line, but not when I use it as CGI.

    If this behaviour of gethostbynamel is intended or unavoidable, it
    should be mentioned in the manual for gethostbynamel.

    Reproduce code:
    ---------------
    <?php
    var_dump(gethostbynamel("localhost"));
    ?>

    Expected result:
    ----------------
    List of addresses

    Actual result:
    --------------
    FALSE


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


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

  4. #3

    Default #40234 [Fbk->Opn]: Tried PHP5.2.1RC4, 25.1.07, same result

    ID: 40234
    User updated by: silverbanana at gmx dot de
    -Summary: gethostbynamel always returns false when using PHP as
    CGI
    Reported By: silverbanana at gmx dot de
    -Status: Feedback
    +Status: Open
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    I just tested it with:
    PHP Version 5.2.1RC4-dev Build Date:Jan 25 2007 12:17:41

    And again it doesn't work with PHP-CGI, but it works with command line
    (Apache module not tested with this version).

    Same result:
    bool(false)


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

    [2007-01-25 11:45:35] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2007-01-25 11:42:39] silverbanana at gmx dot de

    Description:
    ------------
    gethostbynamel always returns false, instead of giving useful results.
    This is however only the case when I use PHP as CGI. gethostbynamel
    works as expected when I use PHP as Apache module and also when I use
    it from the command line, but not when I use it as CGI.

    If this behaviour of gethostbynamel is intended or unavoidable, it
    should be mentioned in the manual for gethostbynamel.

    Reproduce code:
    ---------------
    <?php
    var_dump(gethostbynamel("localhost"));
    ?>

    Expected result:
    ----------------
    List of addresses

    Actual result:
    --------------
    FALSE


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40234&edit=1[/url]
    silverbanana at gmx dot de Guest

  5. #4

    Default #40234 [Opn->Fbk]: gethostbynamel always returns false with CGI SAPI

    ID: 40234
    Updated by: [email]nlopess@php.net[/email]
    -Summary: Tried PHP5.2.1RC4, 25.1.07, same result
    Reported By: silverbanana at gmx dot de
    -Status: Open
    +Status: Feedback
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    I tested with 'php-cgi -f test.php', where test.php contains your
    reproduce code, but I'm not able to reproduce this problem.
    Please check the permissions of the user that is running the PHP CGI
    binary.
    Also, are you running CGI alone (as I did) or from a webserver? And is
    it running in a different user account?


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

    [2007-01-25 12:05:52] silverbanana at gmx dot de

    I just tested it with:
    PHP Version 5.2.1RC4-dev Build Date:Jan 25 2007 12:17:41

    And again it doesn't work with PHP-CGI, but it works with command line
    (Apache module not tested with this version).

    Same result:
    bool(false)

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

    [2007-01-25 11:45:35] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2007-01-25 11:42:39] silverbanana at gmx dot de

    Description:
    ------------
    gethostbynamel always returns false, instead of giving useful results.
    This is however only the case when I use PHP as CGI. gethostbynamel
    works as expected when I use PHP as Apache module and also when I use
    it from the command line, but not when I use it as CGI.

    If this behaviour of gethostbynamel is intended or unavoidable, it
    should be mentioned in the manual for gethostbynamel.

    Reproduce code:
    ---------------
    <?php
    var_dump(gethostbynamel("localhost"));
    ?>

    Expected result:
    ----------------
    List of addresses

    Actual result:
    --------------
    FALSE


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


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

  6. #5

    Default #40234 [Fbk->Opn]: PHP-CGI from command line works, from Apache it doesn't work

    ID: 40234
    User updated by: silverbanana at gmx dot de
    -Summary: gethostbynamel always returns false with CGI SAPI
    Reported By: silverbanana at gmx dot de
    -Status: Feedback
    +Status: Open
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    I've the same result as you when using PHP-CGI from command line.
    PHP-CGI from Apache runs as "NT-AUTORITÄT/SYSTEM", like Apache. So if
    this was the reason gethostnamel should also have failed when using it
    as module, but it didn't when I tested it with PHP6.

    But when I use PHP-CGI with Apache it doesn't work. I somehow suspect
    that Apache and PHP communicate via some TCP/IP connection and that
    this interferes with gethostbynamel.

    FYI, here just the two most important lines from my Apache
    configuration:
    LoadModule fcgid_module modules/mod_fcgid.so
    FCGIWrapper "c:/Programme/Net/php5/php-cgi.exe" .php
    Maybe I've just configured things wrong a bit, but I can't imagine that
    such a strange error could be the result of misconfiguration.


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

    [2007-01-25 12:42:12] [email]nlopess@php.net[/email]

    I tested with 'php-cgi -f test.php', where test.php contains your
    reproduce code, but I'm not able to reproduce this problem.
    Please check the permissions of the user that is running the PHP CGI
    binary.
    Also, are you running CGI alone (as I did) or from a webserver? And is
    it running in a different user account?

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

    [2007-01-25 12:05:52] silverbanana at gmx dot de

    I just tested it with:
    PHP Version 5.2.1RC4-dev Build Date:Jan 25 2007 12:17:41

    And again it doesn't work with PHP-CGI, but it works with command line
    (Apache module not tested with this version).

    Same result:
    bool(false)

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

    [2007-01-25 11:45:35] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2007-01-25 11:42:39] silverbanana at gmx dot de

    Description:
    ------------
    gethostbynamel always returns false, instead of giving useful results.
    This is however only the case when I use PHP as CGI. gethostbynamel
    works as expected when I use PHP as Apache module and also when I use
    it from the command line, but not when I use it as CGI.

    If this behaviour of gethostbynamel is intended or unavoidable, it
    should be mentioned in the manual for gethostbynamel.

    Reproduce code:
    ---------------
    <?php
    var_dump(gethostbynamel("localhost"));
    ?>

    Expected result:
    ----------------
    List of addresses

    Actual result:
    --------------
    FALSE


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


    --
    Edit this bug report at [url]http://bugs.php.net/?id=40234&edit=1[/url]
    silverbanana at gmx dot de Guest

  7. #6

    Default #40234 [Opn->Fbk]: PHP-CGI from command line works, from Apache it doesn't work

    ID: 40234
    Updated by: [email]tony2001@php.net[/email]
    Reported By: silverbanana at gmx dot de
    -Status: Open
    +Status: Feedback
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    Please make sure your firewall does not block DNS requests issued by
    gethostbynamel().
    Just disable the firewall for some time.

    And please use 5.2, not PHP6.
    PHP6 is in pre-alpha stage, which means it's a bit early to test it
    yet.


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

    [2007-01-25 13:16:36] silverbanana at gmx dot de

    I've the same result as you when using PHP-CGI from command line.
    PHP-CGI from Apache runs as "NT-AUTORITÄT/SYSTEM", like Apache. So if
    this was the reason gethostnamel should also have failed when using it
    as module, but it didn't when I tested it with PHP6.

    But when I use PHP-CGI with Apache it doesn't work. I somehow suspect
    that Apache and PHP communicate via some TCP/IP connection and that
    this interferes with gethostbynamel.

    FYI, here just the two most important lines from my Apache
    configuration:
    LoadModule fcgid_module modules/mod_fcgid.so
    FCGIWrapper "c:/Programme/Net/php5/php-cgi.exe" .php
    Maybe I've just configured things wrong a bit, but I can't imagine that
    such a strange error could be the result of misconfiguration.

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

    [2007-01-25 12:42:12] [email]nlopess@php.net[/email]

    I tested with 'php-cgi -f test.php', where test.php contains your
    reproduce code, but I'm not able to reproduce this problem.
    Please check the permissions of the user that is running the PHP CGI
    binary.
    Also, are you running CGI alone (as I did) or from a webserver? And is
    it running in a different user account?

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

    [2007-01-25 12:05:52] silverbanana at gmx dot de

    I just tested it with:
    PHP Version 5.2.1RC4-dev Build Date:Jan 25 2007 12:17:41

    And again it doesn't work with PHP-CGI, but it works with command line
    (Apache module not tested with this version).

    Same result:
    bool(false)

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

    [2007-01-25 11:45:35] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    [2007-01-25 11:42:39] silverbanana at gmx dot de

    Description:
    ------------
    gethostbynamel always returns false, instead of giving useful results.
    This is however only the case when I use PHP as CGI. gethostbynamel
    works as expected when I use PHP as Apache module and also when I use
    it from the command line, but not when I use it as CGI.

    If this behaviour of gethostbynamel is intended or unavoidable, it
    should be mentioned in the manual for gethostbynamel.

    Reproduce code:
    ---------------
    <?php
    var_dump(gethostbynamel("localhost"));
    ?>

    Expected result:
    ----------------
    List of addresses

    Actual result:
    --------------
    FALSE


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


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

  8. #7

    Default #40234 [Fbk->Opn]: can't be the firewall

    ID: 40234
    User updated by: silverbanana at gmx dot de
    -Summary: PHP-CGI from command line works, from Apache it
    doesn't work
    Reported By: silverbanana at gmx dot de
    -Status: Feedback
    +Status: Open
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    I justed tried to disable my firewall. It didn't make any difference.
    Besides, asking for the address of localhost shouldn't need any network
    traffic, should it? I mean, its written in hosts.


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

    [2007-01-25 15:43:42] [email]tony2001@php.net[/email]

    Please make sure your firewall does not block DNS requests issued by
    gethostbynamel().
    Just disable the firewall for some time.

    And please use 5.2, not PHP6.
    PHP6 is in pre-alpha stage, which means it's a bit early to test it
    yet.

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

    [2007-01-25 13:16:36] silverbanana at gmx dot de

    I've the same result as you when using PHP-CGI from command line.
    PHP-CGI from Apache runs as "NT-AUTORITÄT/SYSTEM", like Apache. So if
    this was the reason gethostnamel should also have failed when using it
    as module, but it didn't when I tested it with PHP6.

    But when I use PHP-CGI with Apache it doesn't work. I somehow suspect
    that Apache and PHP communicate via some TCP/IP connection and that
    this interferes with gethostbynamel.

    FYI, here just the two most important lines from my Apache
    configuration:
    LoadModule fcgid_module modules/mod_fcgid.so
    FCGIWrapper "c:/Programme/Net/php5/php-cgi.exe" .php
    Maybe I've just configured things wrong a bit, but I can't imagine that
    such a strange error could be the result of misconfiguration.

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

    [2007-01-25 12:42:12] [email]nlopess@php.net[/email]

    I tested with 'php-cgi -f test.php', where test.php contains your
    reproduce code, but I'm not able to reproduce this problem.
    Please check the permissions of the user that is running the PHP CGI
    binary.
    Also, are you running CGI alone (as I did) or from a webserver? And is
    it running in a different user account?

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

    [2007-01-25 12:05:52] silverbanana at gmx dot de

    I just tested it with:
    PHP Version 5.2.1RC4-dev Build Date:Jan 25 2007 12:17:41

    And again it doesn't work with PHP-CGI, but it works with command line
    (Apache module not tested with this version).

    Same result:
    bool(false)

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

    [2007-01-25 11:45:35] [email]tony2001@php.net[/email]

    Please try using this CVS snapshot:

    [url]http://snaps.php.net/php5.2-latest.tar.gz[/url]

    For Windows:

    [url]http://snaps.php.net/win32/php5.2-win32-latest.zip[/url]



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

    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/40234[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=40234&edit=1[/url]
    silverbanana at gmx dot de Guest

  9. #8

    Default #40234 [Opn->Fbk]: can't be the firewall

    ID: 40234
    Updated by: [email]tony2001@php.net[/email]
    Reported By: silverbanana at gmx dot de
    -Status: Open
    +Status: Feedback
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:
    >I mean, its written in hosts.
    Then the CGI binary should have enough privileges to read it.


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

    [2007-01-25 21:52:59] silverbanana at gmx dot de

    I justed tried to disable my firewall. It didn't make any difference.
    Besides, asking for the address of localhost shouldn't need any network
    traffic, should it? I mean, its written in hosts.

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

    [2007-01-25 15:43:42] [email]tony2001@php.net[/email]

    Please make sure your firewall does not block DNS requests issued by
    gethostbynamel().
    Just disable the firewall for some time.

    And please use 5.2, not PHP6.
    PHP6 is in pre-alpha stage, which means it's a bit early to test it
    yet.

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

    [2007-01-25 13:16:36] silverbanana at gmx dot de

    I've the same result as you when using PHP-CGI from command line.
    PHP-CGI from Apache runs as "NT-AUTORITÄT/SYSTEM", like Apache. So if
    this was the reason gethostnamel should also have failed when using it
    as module, but it didn't when I tested it with PHP6.

    But when I use PHP-CGI with Apache it doesn't work. I somehow suspect
    that Apache and PHP communicate via some TCP/IP connection and that
    this interferes with gethostbynamel.

    FYI, here just the two most important lines from my Apache
    configuration:
    LoadModule fcgid_module modules/mod_fcgid.so
    FCGIWrapper "c:/Programme/Net/php5/php-cgi.exe" .php
    Maybe I've just configured things wrong a bit, but I can't imagine that
    such a strange error could be the result of misconfiguration.

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

    [2007-01-25 12:42:12] [email]nlopess@php.net[/email]

    I tested with 'php-cgi -f test.php', where test.php contains your
    reproduce code, but I'm not able to reproduce this problem.
    Please check the permissions of the user that is running the PHP CGI
    binary.
    Also, are you running CGI alone (as I did) or from a webserver? And is
    it running in a different user account?

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

    [2007-01-25 12:05:52] silverbanana at gmx dot de

    I just tested it with:
    PHP Version 5.2.1RC4-dev Build Date:Jan 25 2007 12:17:41

    And again it doesn't work with PHP-CGI, but it works with command line
    (Apache module not tested with this version).

    Same result:
    bool(false)

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

    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/40234[/url]

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

  10. #9

    Default #40234 [Fbk->Opn]: getaddrinfo ain't working, i think.

    ID: 40234
    User updated by: silverbanana at gmx dot de
    -Summary: gethostbynamel always returns false when using PHP as
    CGI
    Reported By: silverbanana at gmx dot de
    -Status: Feedback
    +Status: Open
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    It just came into my mind that other PHP functions will also need to
    resolve names. So I tried this one:
    $a = file_get_contents("http://www.google.de");

    This results on PHP-CGI with Apache in:
    Warning: file_get_contents() [function.file-get-contents]:
    php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist
    unbekannt. in D:\path\file.php

    So some Windows-API-function is failing.

    Btw, hosts is world readable (I think that's the way it should be,
    right) on my system so that can hardly be the reason.


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

    [2007-01-25 22:01:12] [email]tony2001@php.net[/email]
    >I mean, its written in hosts.
    Then the CGI binary should have enough privileges to read it.

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

    [2007-01-25 21:52:59] silverbanana at gmx dot de

    I justed tried to disable my firewall. It didn't make any difference.
    Besides, asking for the address of localhost shouldn't need any network
    traffic, should it? I mean, its written in hosts.

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

    [2007-01-25 15:43:42] [email]tony2001@php.net[/email]

    Please make sure your firewall does not block DNS requests issued by
    gethostbynamel().
    Just disable the firewall for some time.

    And please use 5.2, not PHP6.
    PHP6 is in pre-alpha stage, which means it's a bit early to test it
    yet.

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

    [2007-01-25 13:16:36] silverbanana at gmx dot de

    I've the same result as you when using PHP-CGI from command line.
    PHP-CGI from Apache runs as "NT-AUTORITÄT/SYSTEM", like Apache. So if
    this was the reason gethostnamel should also have failed when using it
    as module, but it didn't when I tested it with PHP6.

    But when I use PHP-CGI with Apache it doesn't work. I somehow suspect
    that Apache and PHP communicate via some TCP/IP connection and that
    this interferes with gethostbynamel.

    FYI, here just the two most important lines from my Apache
    configuration:
    LoadModule fcgid_module modules/mod_fcgid.so
    FCGIWrapper "c:/Programme/Net/php5/php-cgi.exe" .php
    Maybe I've just configured things wrong a bit, but I can't imagine that
    such a strange error could be the result of misconfiguration.

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

    [2007-01-25 12:42:12] [email]nlopess@php.net[/email]

    I tested with 'php-cgi -f test.php', where test.php contains your
    reproduce code, but I'm not able to reproduce this problem.
    Please check the permissions of the user that is running the PHP CGI
    binary.
    Also, are you running CGI alone (as I did) or from a webserver? And is
    it running in a different user account?

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

    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/40234[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=40234&edit=1[/url]
    silverbanana at gmx dot de Guest

  11. #10

    Default #40234 [Opn->Bgs]: getaddrinfo ain't working, i think.

    ID: 40234
    Updated by: [email]tony2001@php.net[/email]
    Reported By: silverbanana at gmx dot de
    -Status: Open
    +Status: Bogus
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    Not PHP problem.


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

    [2007-01-26 14:33:38] silverbanana at gmx dot de

    It just came into my mind that other PHP functions will also need to
    resolve names. So I tried this one:
    $a = file_get_contents("http://www.google.de");

    This results on PHP-CGI with Apache in:
    Warning: file_get_contents() [function.file-get-contents]:
    php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist
    unbekannt. in D:\path\file.php

    So some Windows-API-function is failing.

    Btw, hosts is world readable (I think that's the way it should be,
    right) on my system so that can hardly be the reason.

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

    [2007-01-25 22:01:12] [email]tony2001@php.net[/email]
    >I mean, its written in hosts.
    Then the CGI binary should have enough privileges to read it.

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

    [2007-01-25 21:52:59] silverbanana at gmx dot de

    I justed tried to disable my firewall. It didn't make any difference.
    Besides, asking for the address of localhost shouldn't need any network
    traffic, should it? I mean, its written in hosts.

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

    [2007-01-25 15:43:42] [email]tony2001@php.net[/email]

    Please make sure your firewall does not block DNS requests issued by
    gethostbynamel().
    Just disable the firewall for some time.

    And please use 5.2, not PHP6.
    PHP6 is in pre-alpha stage, which means it's a bit early to test it
    yet.

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

    [2007-01-25 13:16:36] silverbanana at gmx dot de

    I've the same result as you when using PHP-CGI from command line.
    PHP-CGI from Apache runs as "NT-AUTORITÄT/SYSTEM", like Apache. So if
    this was the reason gethostnamel should also have failed when using it
    as module, but it didn't when I tested it with PHP6.

    But when I use PHP-CGI with Apache it doesn't work. I somehow suspect
    that Apache and PHP communicate via some TCP/IP connection and that
    this interferes with gethostbynamel.

    FYI, here just the two most important lines from my Apache
    configuration:
    LoadModule fcgid_module modules/mod_fcgid.so
    FCGIWrapper "c:/Programme/Net/php5/php-cgi.exe" .php
    Maybe I've just configured things wrong a bit, but I can't imagine that
    such a strange error could be the result of misconfiguration.

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

    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/40234[/url]

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

  12. #11

    Default #40234 [Bgs]: Still can be PHP's fault.

    ID: 40234
    User updated by: silverbanana at gmx dot de
    -Summary: getaddrinfo ain't working, i think.
    Reported By: silverbanana at gmx dot de
    Status: Bogus
    Bug Type: Network related
    Operating System: Windows XP SP2
    PHP Version: 6CVS-2007-01-25 (snap)
    New Comment:

    Just because some Windows API doesn't return what we want doesn't mean
    PHP isn't responsible for that. I think it's quite interesting that PHP
    has it's problems when running as fastCGI under Windows. I just glanced
    at the source and found some interesting comment:
    ---
    cgi_main.c,L1264: for windows, socket listening is broken in the
    fastcgi library itself so dissabling this feature on windows till time
    is available to fix it
    ---
    I'm not sure what exactly was disabled, since fastcgi works so far, but
    there might be side-effects.
    So I think it's worth to take a second look on that error.


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

    [2007-01-26 14:44:02] [email]tony2001@php.net[/email]

    Not PHP problem.

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

    [2007-01-26 14:33:38] silverbanana at gmx dot de

    It just came into my mind that other PHP functions will also need to
    resolve names. So I tried this one:
    $a = file_get_contents("http://www.google.de");

    This results on PHP-CGI with Apache in:
    Warning: file_get_contents() [function.file-get-contents]:
    php_network_getaddresses: getaddrinfo failed: Der angegebene Host ist
    unbekannt. in D:\path\file.php

    So some Windows-API-function is failing.

    Btw, hosts is world readable (I think that's the way it should be,
    right) on my system so that can hardly be the reason.

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

    [2007-01-25 22:01:12] [email]tony2001@php.net[/email]
    >I mean, its written in hosts.
    Then the CGI binary should have enough privileges to read it.

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

    [2007-01-25 21:52:59] silverbanana at gmx dot de

    I justed tried to disable my firewall. It didn't make any difference.
    Besides, asking for the address of localhost shouldn't need any network
    traffic, should it? I mean, its written in hosts.

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

    [2007-01-25 15:43:42] [email]tony2001@php.net[/email]

    Please make sure your firewall does not block DNS requests issued by
    gethostbynamel().
    Just disable the firewall for some time.

    And please use 5.2, not PHP6.
    PHP6 is in pre-alpha stage, which means it's a bit early to test it
    yet.

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

    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/40234[/url]

    --
    Edit this bug report at [url]http://bugs.php.net/?id=40234&edit=1[/url]
    silverbanana at gmx dot de Guest

Posting Permissions

  • You may not post new threads
  • You may 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