laravel 7.x 蛋疼的predis

2020-03-14  本文已影响0人  师娘哪里去了

从旧版本升级到 7.x,一切功能正常,但redis一直报错

   LogicException 

  Please make sure the PHP Redis extension is installed and enabled.

  at vendor/laravel/framework/src/Illuminate/Redis/Connectors/PhpRedisConnector.php:76
    72|     protected function createClient(array $config)
    73|     {
    74|         return tap(new Redis, function ($client) use ($config) {
    75|             if ($client instanceof RedisFacade) {
  > 76|                 throw new LogicException(
    77|                         extension_loaded('redis')
    78|                                 ? 'Please remove or rename the Redis facade alias in your "app" configuration file in order to avoid collision with the PHP Redis extension.'
    79|                                 : 'Please make sure the PHP Redis extension is installed and enabled.'
    80|                 );

通过查看源码分析后发现,config/database.php 文件中配置redis加了默认值

'client' => env('REDIS_CLIENT', 'phpredis'),

好吧,在.env中添加REDIS_CLIENT预设

REDIS_CLIENT=predis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

搞定回家逗猫玩去了~!

上一篇 下一篇

猜你喜欢

热点阅读