Error: invalid service redis class redis does not exist
What's causing the "invalid service redis class redis does not exist" error?
This error message usually appears when Redis PHP extension is missing or when there's a misconfiguration in Laravel. Redis works as an in-memory data structure store used for caching, message brokering, and database.
If you're using Redis in Laravel without installing the Redis PHP extension or have a misconfigured Laravel environment, you may encounter the "invalid service redis class redis does not exist" error. The error happens when Laravel fails to find the Redis class because either Redis PHP extension is absent, or it's incorrectly set up.
Solution- Here's how to resolve it
To fix this error, you need to install and enable Redis PHP extensions on your server configuration. For Linux OS, use package managers like apt or yum, while Homebrew is recommended for macOS.
After installation, ensure that Redis PHP extension is enabled in php.ini file, or the appropriate configuration file for the webserver. Also, double-check if Laravel settings are correctly configured to use Redis with the right port, host, and password where necessary. Finally, restart your PHP service or webserver to apply any changes made to the configuration files.
Was this content helpful?
Other Common Redis Errors (with Solutions)
- could not connect to redis at 127.0.0.1:6379: connection refused
- redis error server closed the connection
- redis.exceptions.responseerror: value is not an integer or out of range
- redis.exceptions.responseerror moved
- redis.exceptions.responseerror noauth authentication required
- redis-server failed to start advanced key-value store
- spring boot redis unable to connect to localhost 6379
- unable to configure redis to keyspace notifications
- redis.clients.jedis.exceptions.jedismoveddataexception
- could not get resource from pool redis
- failed to restart redis service unit redis service not found
- job for redis-server.service failed because a timeout was exceeded
Switch & save up to 80%
Dragonfly is fully compatible with the Redis ecosystem and requires no code changes to implement. Instantly experience up to a 25X boost in performance and 80% reduction in cost