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
- Uncomment the following lines in sites/default/settings.php:
if (file_exists(__DIR__ . '/settings.local.php')) { include __DIR__ . '/settings.local.php'; }
- Copy sites/example.settings.local.php to sites/default/settings.local.php
- 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
Some error
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)
In good order ?
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:
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
6 - clear cache
7 - Done !
Thanks again !
Hi romdouze your order is
Hi romdouze your order is perfect and also we have to make sure below code present in
development.services.yml file.
Define cache.backend.null
What is needed is the following code snippet, that is found inside development.services.yml:
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.
Hero!
This saved my day!
Enable settings.local.php with three commands
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:
Run
drush cr
to clear cache, and thesettings.local.php
should be active.