web-dev-qa-db-ja.com

Memcache「存在しないサービス「cache.backend.memcache」エラー

Memcache.soとmemcached.soが正常に実行され、両方がphpinfoに表示されています。正しいphp.iniファイルに設定し、すべてのサービスを再起動しました。

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).

ご覧のとおり、memcacheモジュールを有効にできません。

nginx php7.0-fpm

1
user3108268

Memcacheモジュールを有効にする必要があります前にモジュールを構成します。サービスは、モジュールが有効な場合にのみ存在します。

少なくともredisモジュールを使用すると、手動でクラスローダーに登録して、services.ymlファイルを明示的に追加することもできますが、それがmemcacheにも当てはまるかどうかはわかりません。 https://docs.platform.sh/frameworks/drupal8/redis.html を参照してください

3
Berdir