美文网首页
laravel 7.x 蛋疼的predis

laravel 7.x 蛋疼的predis

作者: 师娘哪里去了 | 来源:发表于2020-03-14 12:30 被阅读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

搞定回家逗猫玩去了~!

相关文章

网友评论

      本文标题:laravel 7.x 蛋疼的predis

      本文链接:https://www.haomeiwen.com/subject/ibyvshtx.html