2

I have a successfully running and memcache.so and memcached.so and both are shown in phpinfo, I have set them in correct php.ini file and restarted all services.

sudo service memcached status

* memcached.service - memcached daemon
   Loaded: loaded (/lib/systemd/system/memcached.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2017-02-11 22:16:41 UTC; 7min ago
 Main PID: 12367 (memcached)
    Tasks: 6
   Memory: 548.0K
      CPU: 27ms
   CGroup: /system.slice/memcached.service
           `-12367 /usr/bin/memcached -m 128 -p 11211 -u memcache -l 127.0.0.1

settings.php:

$settings['memcache']['servers'] = ['127.0.0.1:11211' => 'default'];
$settings['memcache']['bins'] = ['default' => 'default'];
$settings['memcache']['key_prefix'] = '';
$settings['cache']['default'] = 'cache.backend.memcache';

drush en memcache:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "cache.backend.memcache". Did you mean one of these: "cache.backend.database", "cache.backend.apcu", "cache.backend.php", "cache.backend.memory"? in /var/www/d8.com/htdocs/core/lib/Drupal/Component/DependencyInjection/Container.php on line 157 #0 /var/www/d8.com/htdocs/core/lib/Drupal/Core/Cache/ChainedFastBackendFactory.php(79): Drupal\Component\DependencyInjection\Container->get('cache.backend.m...')
#1 /var/www/d8.com/htdocs/core/lib/Drupal/Core/Cache/CacheFactory.php(83): Drupal\Core\Cache\ChainedFastBackendFactory->get('bootstrap')
#2 [internal function]: Drupal\Core\Cache\CacheFactory->get('bootstrap')
#3 /var/www/d8.com/htdocs/core/lib/Drupal/Component/DependencyInjection/Container.php(254): call_user_func_array(Array, Array)
#4 /var/www/d8.com/htdocs/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'cache.bootstrap')
#5 /var/www/d8.com/htdocs/core/lib/Drupal/Component/DependencyInjection/Container.php(494): Drupal\Component\DependencyInjection\Container->get('cache.bootstrap', 1)
#6 /var/www/d8.com/htdocs/core/lib/Drupal/Component/DependencyInjection/Container.php(236): Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array)
#7 /var/www/d8.com/htdocs/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService(Array, 'module_handler')
#8 /var/www/d8.com/htdocs/core/lib/Drupal/Core/DrupalKernel.php(544): Drupal\Component\DependencyInjection\Container->get('module_handler')
#9 /var/www/d8.com/htdocs/core/lib/Drupal/Core/DrupalKernel.php(702): Drupal\Core\DrupalKernel->preHandle(Object(Symfony\Component\HttpFoundation\Request))
#10 phar:///usr/local/bin/drush/lib/Drush/Boot/DrupalBoot8.php(150): Drupal\Core\DrupalKernel->prepareLegacyRequest(Object(Symfony\Component\HttpFoundation\Request))
#11 phar:///usr/local/bin/drush/includes/bootstrap.inc(354): Drush\Boot\DrupalBoot8->bootstrap_drupal_full()
#12 phar:///usr/local/bin/drush/includes/bootstrap.inc(473): drush_bootstrap(5, 6)
#13 phar:///usr/local/bin/drush/lib/Drush/Boot/BaseBoot.php(59): drush_bootstrap_to_phase(6)
#14 phar:///usr/local/bin/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#15 phar:///usr/local/bin/drush/includes/startup.inc(458): drush_main()
#16 phar:///usr/local/bin/drush/includes/startup.inc(365): drush_run_main(false, '/', 'Phar detected. ...')
#17 phar:///usr/local/bin/drush/drush(114): drush_startup(Array)
#18 /usr/local/bin/drush(10): require('phar:///usr/loc...')
#19 {main}
Drush command terminated abnormally due to an unrecoverable error.                                                                                                                                  [error]
Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "cache.backend.memcache". Did you mean one of these: "cache.backend.database", "cache.backend.apcu", "cache.backend.php", "cache.backend.memory"? in Drupal\Component\DependencyInjection\Container->get() (line 157 of /var/www/d8.com/htdocs/core/lib/Drupal/Component/DependencyInjection/Container.php).

So as you can see I cannot manage to enable the memcache module.

nginx php7.0-fpm

1

1 Answer 1

5

You need to enable the memcache module before configuring it. The services only exist when a module is enabled.

At least with the redis module, it is also possible to manually register it to the classloader and explicitly add the services.yml file, but I don't know if that's true for memcache as well. See https://docs.platform.sh/frameworks/drupal8/redis.html

10
  • Module memcache doesn't meet the requirements to be enabled. [error] (Currently using Extensions not available version Either the memcache or memcached extensions must be installed in order to use memcache integration.) Feb 12, 2017 at 9:39
  • Yes, then you need to enable one of those two extensions
    – Berdir
    Feb 12, 2017 at 9:43
  • But they are enabled like I posted before. How do you test if they are enabled? Feb 12, 2017 at 9:49
  • Well, PHP thinks they are not. Maybe you have different php.ini files for php fpm and CLI. Try php -m, try php -i and check the php.ini location
    – Berdir
    Feb 12, 2017 at 9:58
  • @user3108268 admin/reports/status/php will also show if either is enabled.
    – mpdonadio
    Feb 12, 2017 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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