From: metala at metala dot org
Operating system: Windows XP SP2
PHP version: 5.2.9
PHP Bug Type: Network related
Bug description: Unknown error using fsockopen() when with php-cgi through php cli
Description:
------------
The problem persists in 5.2.6, 5.2.9 and 5.2.9-1 in Windows only.
I have 2 script files, a parent.php and a child.php. The parent.php, which
is running in CLI, starts the child.php with php-cgi.exe.
fsockopen(), or any other network function fails.
Reproduce code:
---------------
parent.php
<?php
$env = array (
'SCRIPT_FILENAME' => dirname(__FILE__).'\\child.php',
);
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w"),
);
$procName = 'php-cgi';
$proc = proc_open($procName, $descriptorspec, $pipes, null, $env,
array('bypass_shell' => true));
$read = array($pipes[1]);
stream_select($read, $null = array(), $null = array(), 100);
echo fread($read[0], 1024);
child.php
<?php
$fp = fsockopen('127.0.0.1', 445, $errno, $errstr);
var_dump($errno, $errstr);
Expected result:
----------------
I expect no error to be returned, because 445 is opened and even telnet
manages to connect.
Actual result:
--------------
H:\test\php>php parent.php
X-Powered-By: PHP/5.2.9-1
Content-type: text/html
<br />
<b>Warning</b>: fsockopen() [<a
href='function.fsockopen'>function.fsockopen</a
>]: unable to connect to 127.0.0.1:445 (Unknown error) in
<b>H:\test\php\child.p
hp</b> on line <b>2</b><br />
int(0)
string(0) ""
--
Edit bug report at http://bugs.php.net/?id=47630&edit=1
--
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47630&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47630&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47630&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=47630&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47630&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=47630&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=47630&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=47630&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=47630&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=47630&r=support
Expected behavior: http://bugs.php.net/fix.php?id=47630&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=47630&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=47630&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=47630&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=47630&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=47630&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=47630&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=47630&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=47630&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=47630&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=47630&r=mysqlcfg