framework: Class 'Redis' not found

  • Laravel Version: 6.0.3
  • PHP Version: 7.3.9
  • Database Driver & Version:
php-redis 5.0.2-2
redis 5.0.5-1

Description:

I’ve starting to upgrade from 5.8 to Laravel 6.0. As recommended by the docs I’ve moved to phpredis.

I already removed the Redis alias, but it keeps using the wrong driver (at least I think so): image

Steps To Reproduce:

  1. Upgrade to 6.0
  2. Removed predis
  3. Update all configs, including 'client' => env('REDIS_CLIENT', 'phpredis'),

If more info is needed, please let me know.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 20 (4 by maintainers)

Most upvoted comments

By default In Laravel 6 ‘client’ => env(‘REDIS_CLIENT’, ‘phpredis’), is not working but when i change this ‘client’ => env(‘REDIS_CLIENT’, ‘predis’),.Why this Problem Occurred If It elaborate then it will be helpful

Change “phpredis” to “predis” it work pefectly!

By default In Laravel 6 ‘client’ => env(‘REDIS_CLIENT’, ‘phpredis’), is not working but when i change this ‘client’ => env(‘REDIS_CLIENT’, ‘predis’),.Why this Problem Occurred If It elaborate then it will be helpful

Just installed php-redis and pecl install redis

Btw, this reads confusing because it’s meant to be the same thing. You probably meant sudo apt-get install php-redis and when you also do pecl… you could end up with the same PHP extension twice on your system.

Usually sudo apt-get install php-redis also enables it. If not, sudo phpenmod redis will do. It’s implicitly does something similar to https://github.com/laravel/framework/issues/29955#issuecomment-549785611

Tread carefully as to not mix stuff here on your server!

‘redis’ => [ ‘cluster’ => false, ‘client’ => env(‘REDIS_CLIENT’, ‘predis’), ‘default’ => [ ‘host’ => env(‘REDIS_HOST’, ‘127.0.0.1’), ‘port’ => env(‘REDIS_PORT’, 6379), ‘database’ => env(‘REDIS_DATABASE’, 0), ‘password’ => env(‘REDIS_PASSWORD’, ‘’), ],

],

In which file?

It’s in: /config/database.php

You can simply add REDIS_CLIENT=predis to your .env file

Sorry for the noise, it seems the php-redis extension wasn’t (correctly) enabled.

We’ll update the solution for this in ignition 👍