#40234 [Opn->Fbk]: PHP-CGI from command line works, from Apache it doesn't work
| From: | tony2001@php.net | Date: | Thu, 25 Jan 2007 15:43:42 +0000 |
| Subject: | #40234 [Opn->Fbk]: PHP-CGI from command line works, from Apache it doesn't work | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-108050@lists.php.net to get a copy of this message | ||
ID: 40234
Updated by: tony2001@php.net
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] nlopess@php.net
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] tony2001@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5.2-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5.2-win32-latest.zip
------------------------------------------------------------------------
[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 http://bugs.php.net/?id=40234&edit=1