反应警告“stream_select():不能将ZMQ_FD类型的流表示为select()能够描述符”

时间:2015-01-18 16:48:50

标签: php zeromq ratchet reactphp

我第一次尝试使用Ratchet并且正在关注the push tutorial

我在push-server.php中有以下代码:

namespace app\ratchet;
require_once(__DIR__ . '/../common_functions.php'); // my autoloader
require __DIR__ . '/../../vendor/autoload.php'; // composer autoloader

use app\ratchet\Pusher;

use Ratchet\Server\IoServer;
use Ratchet\Http\HttpServer;
use Ratchet\WebSocket\WsServer;

$loop   = \React\EventLoop\Factory::create();
$pusher = new Pusher;

// Listen for the web server to make a ZeroMQ push after an ajax request
$context = new \React\ZMQ\Context($loop);
$pull = $context->getSocket(\ZMQ::SOCKET_PULL);
$pull->bind('tcp://127.0.0.1:8184'); // Binding to 127.0.0.1 means the only client that can connect is itself
$pull->on('message', array($pusher, 'onBlogEntry'));

// Set up our WebSocket server for clients wanting real-time updates
$webSock = new \React\Socket\Server($loop);
$webSock->listen(8185, '0.0.0.0'); // Binding to 0.0.0.0 means remotes can connect
$webServer = new \Ratchet\Server\IoServer(
    new \Ratchet\Http\HttpServer(
        new \Ratchet\WebSocket\WsServer(
            new \Ratchet\Wamp\WampServer(
                $pusher
            )
        )
    ),
    $webSock
);

$loop->run();

当我运行文件时,我收到以下警告

Warning: stream_select(): cannot represent a stream of type ZMQ_FD as a select()able descriptor in [...]\vendor\react\event-loop\StreamSelectLoop.php on line 255

Call Stack:
    0.0000     237608   1. {main}() [...]\app\ratchet\push-server.php:0
    0.0130    1400696   2. React\EventLoop\StreamSelectLoop->run() [...]\app\ratchet\push-server.php:36
    0.0130    1401688   3. React\EventLoop\StreamSelectLoop->waitForStreamActivity() [...]\vendor\react\event-loop\StreamSelectLoop.php:201
    0.0130    1402240   4. React\EventLoop\StreamSelectLoop->streamSelect() [...]\vendor\react\event-loop\StreamSelectLoop.php:221
    0.0130    1402384   5. stream_select() [...]\vendor\react\event-loop\StreamSelectLoop.php:255

\vendor\react\event-loop\StreamSelectLook.php中引用的行是:

return stream_select($read, $write, $except, $timeout === null ? null : 0, $timeout);

我之前从未使用过Ratchet或ZeroMQ,并且正在努力了解问题所在。在搜索时,我无法在Google上找到任何有用的信息。

我在Windows 7 x 64上运行WampServer x 64.我按照this guide了解了如何安装ZMQ。

以下是一些调试截图:

enter image description here

enter image description here

导致此问题的原因以及如何解决?

1 个答案:

答案 0 :(得分:3)

在尝试找出此问题的解决方案大约五个小时后,我尝试根据我在某处阅读的评论安装32位版本的WampServer并解决了问题。因此看起来stream_select()问题是由WampServer问题引起的。

我会在这里留下这个问题,因为我确信有人会在某些时候遇到同样的问题,希望这会为他们节省很多时间。