PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, November 12, 2022

[FIXED] How to implement Memcache in Drupal 8?

 November 12, 2022     drupal-8, memcached     No comments   

Issue

I read a few very good online resources that describe how exactly we can implement Memcache in Drupal 8. for e.g. this one

https://www.valuebound.com/resources/blog/configuring-memcache-drupal-8-to-reduce-database-load

At the Drupal end I have installed two new modules for Memcache:

  1. Memcached
  2. Memcached Storage

But, when trying to enable them it throws an error "PHP extension is required".

Also, getting this error "Unable to initialize module" when trying to install PHP extension using below command:

sudo apt install php-memcached


Solution

Finally, I found the solution.

Add Memcache in Drupal-8

  1. Added two new modules and installed them in Drupal.

    • Memcache
    • Memcache Admin

  1. Install below packages in existing Drupal Dockerfile.

    • libmemcached-dev
    • memcached
    • Docker-php-ext-enable memcached
  2. Finally, update settings.php with memcache configs (../web/sites/default/settings.php)

$settings['memcache']['servers'] = ['127.0.0.1:11211' => 'default'];
$settings['cache']['bins']['render'] = 'cache.backend.memcache';
$settings['cache']['bins']['dynamic_page_cache'] = 'cache.backend.memcache';
$settings['memcache_storage']['debug'] = TRUE;

Note: We can view Memcache statistic via https://localhost/admin/reports/memcache

enter image description here

Memcache is installed successfully!



Answered By - Aftab
Answer Checked By - David Marino (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing