https://www.drupal.org/node/1903374 gives instructions for disabling the render cache in Drupal. Since I'm just playing in a sandbox where I'll be experimenting with themimg, this is want I want to do.
The instructions are as follows

  1. Uncomment the following lines in sites/default/settings.php:
    if (file_exists(__DIR__ . '/settings.local.php')) {
      include __DIR__ . '/settings.local.php';
    }
    
  2. Copy sites/example.settings.local.php to sites/default/settings.local.php
  3. Uncomment the following two lines in sites/default/settings.local.php
    $settings['cache']['bins']['render'] = 'cache.backend.null';
    $settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

Reloading after these changes earns me the error message:

The website encountered an unexpected error. Please try again later.
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "cache.backend.null". Did you mean one of these: "cache.backend.apcu", "cache.backend.php", "cache.backend.memory"? in Drupal\Component\DependencyInjection\Container->get() (line 161 of core\lib\Drupal\Component\DependencyInjection\Container.php).

Drupal\Component\DependencyInjection\Container->get('cache.backend.null')
Drupal\Core\Cache\CacheFactory->get('render')
call_user_func_array(Array, Array)
Drupal\Component\DependencyInjection\Container->createService(Array, 'cache.render')
Drupal\Component\DependencyInjection\Container->get('cache.render', 1)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Object)
Drupal\Component\DependencyInjection\Container->createService(Array, 'http_middleware.page_cache')
Drupal\Component\DependencyInjection\Container->get('http_middleware.page_cache', 1)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Object)
Drupal\Component\DependencyInjection\Container->createService(Array, 'http_middleware.reverse_proxy')
Drupal\Component\DependencyInjection\Container->get('http_middleware.reverse_proxy', 1)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Object)
Drupal\Component\DependencyInjection\Container->createService(Array, 'http_middleware.negotiation')
Drupal\Component\DependencyInjection\Container->get('http_middleware.negotiation', 1)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Object)
Drupal\Component\DependencyInjection\Container->createService(Array, 'http_kernel')
Drupal\Component\DependencyInjection\Container->get('http_kernel')
Drupal\Core\DrupalKernel->getHttpKernel()
Drupal\Core\DrupalKernel->handle(Object)

I tried copying sites/development.services.yml to sites/default/development.services.yml. That solved the problem. I was going to update https://www.drupal.org/node/1903374 to add this instruction, but I wanted to make sure my lucky guess fix was really the right one. Does anyone know for sure?

Comments

kamalMaroc’s picture

The website encountered an unexpected error. Please try again later.
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "cache.backend.null". Did you mean one of these: "cache.backend.apcu", "cache.backend.php", "cache.backend.memory"? in Drupal\Component\DependencyInjection\Container->get() (line 161 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal\Component\DependencyInjection\Container->get('cache.backend.null')
Drupal\Core\Cache\CacheFactory->get('render')
call_user_func_array(Array, Array)
Drupal\Component\DependencyInjection\Container->createService(Array, 'cache.render')
Drupal\Component\DependencyInjection\Container->get('cache.render', 1)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Object)
Drupal\Component\DependencyInjection\Container->createService(Array, 'http_middleware.page_cache')
Drupal\Component\DependencyInjection\Container->get('http_middleware.page_cache', 1)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Object)
Drupal\Component\DependencyInjection\Container->createService(Array, 'http_middleware.reverse_proxy')
Drupal\Component\DependencyInjection\Container->get('http_middleware.reverse_proxy', 1)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Object)
Drupal\Component\DependencyInjection\Container->createService(Array, 'http_middleware.negotiation')
Drupal\Component\DependencyInjection\Container->get('http_middleware.negotiation', 1)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Object)
Drupal\Component\DependencyInjection\Container->createService(Array, 'http_kernel')
Drupal\Component\DependencyInjection\Container->get('http_kernel')
Drupal\Core\DrupalKernel->getHttpKernel()
Drupal\Core\DrupalKernel->handle(Object)

romdouze’s picture

Hello, and thank you jemandy for this information,
very usefull !!

First it didn't work, but when i executed your instructions in this following order, it worked !

1 - Uncomment the following lines in sites/default/settings.php:

if (file_exists(__DIR__ . '/settings.local.php')) {
  include __DIR__ . '/settings.local.php';
}

2 - Copy sites/example.settings.local.php to sites/default/settings.local.php

3 - Copy sites/development.services.yml to sites/default/development.services.yml

4 - clear cache

5 - Uncomment the following two lines in sites/default/settings.local.php

$settings['cache']['bins']['render'] = 'cache.backend.null';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.null';

6 - clear cache

7 - Done !

Thanks again !

prabhakarb’s picture

Hi romdouze your order is perfect and also we have to make sure below code present in 

development.services.yml file.

parameters:
  http.response.debug_cacheability_headers: true
services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory
eigentor’s picture

What is needed is the following code snippet, that is found inside development.services.yml:

services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory

This defines the service cache.backend.null that is non-existent before.

I ran into the error because I did not copy development.services.yml but instead copied default.services.yml and renamed it to services.yml.

If do it like me and copy the above code snippet into services.yml, then clear cache again, everything works.

SvenVdv’s picture

This saved my day!

ressa’s picture

The settings.local.php instructions and files, and their set up has probably been updated, so it's now possible to create a local settings.php file, and activate it with these three commands:

# copy settings.local.php to sites/default directory
cp sites/example.settings.local.php sites/default/settings.local.php

# disable page caching, by removing commented out lines
sed -i.bak 's/^# $settings/$settings/' sites/default/settings.local.php

# enable settings.local.php, insert this at the bottom of settings.php:
echo -e "if (file_exists(__DIR__ . '/settings.local.php')) {
  include __DIR__ . '/settings.local.php';
}" >> sites/default/settings.php

Run drush cr to clear cache, and the settings.local.php should be active.