I'm trying to enable Redis on my Drupal site but when I check the status of the module I keep getting this warning message:

No Redis client connected, this module is useless thereof. Ensure that you enabled module using it or disable it.

The steps I followed to enable Redis:

  1. Edited config.yml

installed_extras:
  - redis
  - php-redis

  1. Enabled the Redis module

  2. Edit settings.php and added the following settings:


$settings['cache']['default'] = 'cache.backend.redis';

$settings['redis.connection']['interface'] = 'PhpRedis';

$settings['container_yamls'][] = 'modules/redis/example.services.yml';

$settings['container_yamls'][] = 'modules/redis/redis.services.yml';

I also tried to execute the following code in index.php and the cache appears to be working:

$redis = new Redis();
$redis->connect('127.0.0.1');
$cache = $redis->get('key');
//Cache miss
if($cache === false) {
  echo "miss";
  $cache = "test";
  $redis->set('key',$cache);
}else{
  echo "didn't miss";
}
// At this point $cache is either the retrieved cache or a fresh copy, so echo it
echo $cache;
exit();

So it appears that Redis is working but for some reason it isn't used by Drupal.

New contributor
TheBauer is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

For Drupal 8, use this code in the settings.php file:

$settings['redis.connection']['host'] = 'localhost';
$settings['redis.connection']['port'] = NULL;
$settings['cache']['default'] = 'cache.backend.redis';
$settings['redis.connection']['base'] = 101;

You can check whether or not Redis is running by viewing the status report at: /admin/reports/status

New contributor
scriptbox is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

TheBauer is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.