ErrorException: Undefined array key “host” in E:\project\webman2025\vendor\workerman\workerman\src\Connection\AsyncTcpConnection.php:177
这个问题webman框架的redis-queue插件中的配置,config/plugin/webman/redis-queue/redis.php
此文件的host参数对应的值不是简单的ip地址,格式如下:
‘host’ => ‘redis://127.0.0.1:6379’
严格按照这个格式写即可。
<?php
return [
'default' => [
'host' => "redis://" . env('REDIS_HOST', '127.0.0.1') . ":6379",
'options' => [
'auth' => env('REDIS_PASSWORD', null),
'db' => env('REDIS_DB', 0),
'prefix' => 'wrdqueue:',
'max_attempts' => 5,
'retry_seconds' => 5,
],
// Connection pool, supports only Swoole or Swow drivers.
'pool' => [
'max_connections' => 5,
'min_connections' => 1,
'wait_timeout' => 3,
'idle_timeout' => 60,
'heartbeat_interval' => 50,
]
],
];