求助:webman命令行工具使用redis-queue出错[已解决]

aulian
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $queue = 'execcommand';
        $data = ['to' => 'tom@gmail.com', 'content' => 'hello'];
        Client::send($queue, $data);
        return self::SUCCESS;
    }

E:\Code_op>php webman exec:test

Fatal error: Uncaught Error: Call to undefined function pcntl_alarm() in E:\Code_op\vendor\workerman\workerman\Timer.php:127
 Stack trace:
 #0 E:\Code_op\support\bootstrap\LaravelDb.php(78): Workerman\Timer::add(55, Object(Closure))
 #1 E:\Code_op\webman(26): support\bootstrap\LaravelDb::start(NULL)
 #2 {main}
  thrown in E:\Code_op\vendor\workerman\workerman\Timer.php on line 127

尝试升级到了最新版

composer require workerman/webman-framework ^1.3.0 && composer require webman/console ^1.0.16 && ./webman install

报错如下

[InvalidArgumentException]
Could not find a matching version of package workerman/webman-framework. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-sta
bility (stable).

原因:阿里云镜像的composer源更新慢,请使用官方源(见https://www.workerman.net/q/8007)

切换为官方源:
composer config -g repo.packagist composer https://repo.packagist.org

再升级正常,但是前述问题还在。

composer info输出如下

webman/console v1.0.16 Webman console
webman/redis-queue v1.1.0 Redis message queue plugin for webman.
workerman/crontab v1.0.2 A crontab written in PHP based on workerman
workerman/redis v1.0.7
workerman/redis-queue v1.0.5 Message queue system written in PHP based on workerman and backed by Redis.
workerman/webman-framework v1.3.0 High performance HTTP Service Framework.
workerman/workerman v4.0.30 An asynchronous event driven PHP framework for easily building fast, scalable network applications.

另一个方法是不升级webman,但是使用低版本(1.0.1)的webman/redis-queue

webman升级了版本1.1.3,删除了env依赖,变动了一些命名空间。
support/bootstrap/xxxx 改成了 support/xxxxx。
(见https://www.workerman.net/q/7523)

1180 0 0
0个回答

年代过于久远,无法发表回答
🔝