简体   繁体   中英

“Unknown response prefix: 'H'” when connecting to redis in laravel

I have tried "telnet 12.123.123.123 80" and using redis-commander. Everthing works perfectly fine but when run the code, it shows "Unknown response prefix: 'H'". Here's my code:

$redisResultData = \RedisServer::connection('td_slave')->PING();

/config/app.php

'aliases' => [
   'RedisServer' => Illuminate\Support\Facades\Redis::class
]

/config/database.php:

'td_slave' => [
            'host' => '12.123.123.123',
            'password' => null,
            'port' => 80,
            'database' => 0,
        ],

Error msg:

"Unknown response prefix: 'H'. [tcp://12.123.123.123:80], file:/var/www/melon_back_member/vendor/predis/predis/src/Connection/AbstractConnection.php, line:167"

When I try this:

dd(config('database.redis.td_slave'),\RedisServer::connection('td_slave'));

It shows:

在此处输入图片说明

如果您在laradock实例中使用HHVM作为 PHP 编译器,请将laradock更改为PHP-FPM ,它应该可以正常工作。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM