|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-08-24 22:05 UTC] mwilmes at avc dot edu
Description:
------------
Using stream_select on Windows generates a warning:
Warning: stream_select(): unable to select [2]: No such file or directory (max_fd=1168) in C:\path\x.php on line 8
Should not create an error. Note that fd changes per iteration. Error exists using both CLI and Apache php5apache2_4.dll.
Test script:
---------------
<?php
$timeout = 15;
$socket = fsockopen("www.google.com",80,$errno,$errstr,$timeout);
fwrite($socket, "GET / HTTP/1.0\r\n\r\n");
echo fgets($socket);
fclose($socket);
echo "<br>";
$socket = fsockopen("www.google.com",80,$errno,$errstr,$timeout);
$sock_r = null;
$sock_w = array($socket);
$sock_e = null;
$result = stream_select($sock_r,$sock_w,$sock_e,$timeout);
if ($result !== false) {
fwrite($socket, "GET / HTTP/1.0\r\n\r\n");
echo fgets($socket);
}
fclose($socket);
?>
Expected result:
----------------
HTTP/1.0 200 OK
<br>
HTTP/1.0 200 OK
Actual result:
--------------
HTTP/1.0 200 OK
Warning: stream_select(): unable to select [2]: No such file or directory (max_fd=1352) in C:\path\x.php on line 15
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 18 22:00:01 2025 UTC |
Updated test script: <?php $timeout = 15; $socket = fsockopen("www.google.com",80,$errno,$errstr,$timeout); var_dump($socket); if(!$socket) { echo "Error: bad socket\n"; } else { fwrite($socket, "GET / HTTP/1.0\r\n\r\n"); echo fgets($socket); fclose($socket); } echo "<br>\n"; $socket = fsockopen("www.google.com",80,$errno,$errstr,$timeout); var_dump($socket); if(!$socket) { echo "Error: bad socket\n"; } else { $sock_r = null; $sock_w = array($socket); $sock_e = null; $result = stream_select($sock_r,$sock_w,$sock_e,$timeout); var_dump($result); fwrite($socket, "GET / HTTP/1.0\r\n\r\n"); echo fgets($socket); fclose($socket); } ----- Current output: C:\php>php bug.php resource(4) of type (stream) HTTP/1.0 200 OK <br> resource(5) of type (stream) Warning: stream_select(): unable to select [2]: No such file or directory (max_f d=300) in C:\php\bug.php on line 26 bool(false) HTTP/1.0 200 OK ----- PHP version: C:\php>php -v PHP 5.6.12 (cli) (built: Aug 6 2015 12:05:19) I uninstalled the Security Suite software to ensure it was not related to that. Still have the same issue. If this is an environment issue, what things should I be looking for? I will also take a copy of this home and test it there.Updated test script: <?php $timeout = 15; $socket = fsockopen("www.google.com",80,$errno,$errstr,$timeout); var_dump($socket); if(!$socket) { echo "Error: bad socket\n"; } else { fwrite($socket, "GET / HTTP/1.0\r\n\r\n"); echo fgets($socket); fclose($socket); } echo "<br>\n"; $socket = fsockopen("www.google.com",80,$errno,$errstr,$timeout); var_dump($socket); if(!$socket) { echo "Error: bad socket\n"; } else { $sock_r = null; $sock_w = array($socket); $sock_e = null; $result = stream_select($sock_r,$sock_w,$sock_e,$timeout); var_dump($result); fwrite($socket, "GET / HTTP/1.0\r\n\r\n"); echo fgets($socket); fclose($socket); } ----- Current output: C:\php>php bug.php resource(4) of type (stream) HTTP/1.0 200 OK <br> resource(5) of type (stream) Warning: stream_select(): unable to select [2]: No such file or directory (max_f d=300) in C:\php\bug.php on line 26 bool(false) HTTP/1.0 200 OK ----- PHP version: C:\php>php -v PHP 5.6.12 (cli) (built: Aug 6 2015 12:05:19) I uninstalled the Security Suite software to ensure it was not related to that. Still have the same issue. If this is an environment issue, what things should I be looking for? I will also take a copy of this home and test it there.