laravel集成workerman,使用異步mysql,redis組件時,報錯EventBaseConfig::FEATURE_FDS not supported on Windows

因爲laravel項目中集成了workerman,因業務須要,須要使用異步的mysql和redis組件。php

composer require react/mysql
composer require clue/redis-react

安裝完成後,直接致使workerman沒法啓動,並報錯。mysql

EventException  : EventBase cannot be constructed with the provided configura
tion. Make sure that the specified features are supported on the current platform.

而後一頓百度,google,發如今github上有人已經提交了bug。react

https://github.com/reactphp/event-loop/pull/192

說明在windows下不支持 EventBaseConfig::FEATURE_FDS。laravel

 

解決方法:git

在 vendor/react/event-loop/src/ExtEventLoop.php 文件 48 行,加上判斷。github

if ('WIN' !== strtoupper(substr(PHP_OS, 0, 3))) {
    $config->requireFeatures(EventBaseConfig::FEATURE_FDS);
}
相關文章
相關標籤/搜索