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:
- Memcached
- 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
Added two new modules and installed them in Drupal.
- Memcache
- Memcache Admin
Install below packages in existing Drupal Dockerfile.
- libmemcached-dev
- memcached
- Docker-php-ext-enable memcached
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
Memcache is installed successfully!
Answered By - Aftab Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.