Error guides

Class "Redis" not found

Laravel uses the phpredis extension by default, and the PHP running your code has not loaded it. Install and enable the extension, or switch to Predis.

Message
Class "Redis" not found
Exception
Error

What it means

The Redis class comes from the phpredis PHP extension, not from Laravel or Composer. Laravel's default Redis client is phpredis: 'client' => env('REDIS_CLIENT', 'phpredis') in config/database.php. When your app first uses Redis, through the cache, sessions, a queue or the Redis facade, Laravel runs new Redis, and PHP stops with this Error because that PHP process has not loaded the extension.

Why it happens

  • The extension is not installed at all.
  • It is loaded in one PHP but not the other. The command line and PHP-FPM can read different ini files, so php -m lists redis while web requests fail, or the web works while php artisan queue:work fails.
  • A Docker image was built without it. With the official php images you add it in the Dockerfile yourself.
  • PHP was upgraded. An extension is built for one PHP version, and the new version needs its own copy.
  • REDIS_CLIENT is not set and you meant to use Predis. Without it, Laravel uses phpredis.

If your config/app.php registers a Redis facade alias, the same cause shows up as a LogicException: "Please make sure the PHP Redis extension is installed and enabled."

How to fix it

Check what each PHP loads. php --ini names the ini files the command line reads:

php -m | grep -i redis
php --ini
php artisan config:show database.redis.client

For PHP-FPM, ask the FPM binary itself. Its name often carries the version, such as php-fpm8.4:

php-fpm -m | grep -i redis

Install the extension for the PHP version you run. PIE, the installer that replaces the now deprecated PECL, builds and enables it. After pecl install, add extension=redis.so to the ini file PHP reads if the installer did not:

pie install phpredis/phpredis
pecl install redis

On Debian and Ubuntu, php-redis is the package for the distribution's default PHP; another PHP version needs the package with its version in the name, such as php8.4-redis. Fedora calls it php-pecl-redis6, and EPEL carries that for RHEL 9:

sudo apt install php-redis

In a Dockerfile based on the official php image, pin a version as its documentation advises:

RUN pecl install redis-6.3.0 && docker-php-ext-enable redis

Then restart PHP-FPM and your queue workers; a running process does not pick up a new extension.

If you cannot install extensions, use Predis, a client written in PHP:

composer require predis/predis
REDIS_CLIENT=predis

If you cache configuration, run php artisan config:cache afterwards.

Find it in production

With APP_DEBUG=false, a page that uses Redis answers 500 with the "Server Error" page. With sessions in Redis, every web page fails, while /up kept answering 200. Laravel reports the error, since Error is not on the handler's internalDontReport list, and writes it at error level to storage/logs/laravel.log. A queue worker that fails this way writes the same error to that file; in the test it printed nothing to its own output. Ranetrace's error monitoring records each reported error with its stack trace, as long as the queue and the cache store Ranetrace uses do not themselves depend on Redis; with a Redis queue or cache, capture fails on the same error and the report is dropped, so read the log file instead.

Reproduced on Laravel 13.45, PHP 8.5, 5 December 2026.

Start monitoring today

Websites go down and code throws errors. Ranetrace tells you when it happens to yours, why it matters and what to do next.

Start your 30-day free trial From $9 a month. No credit card required.