Skip to main content
Drupal 8

Main navigation

  • Home
    • Question And Answer
    • NEWS
    • Projects
  • Tutorials - Drupal
    • Android
    • Other
User account menu
  • Log in

Breadcrumb

  1. Home

Memcache - Install memcached on linux and Drupal.

By editor , 24 April, 2017
Question

How to install and configure memcached on debian 8 linux (or similar like ubuntu ...)  and setup with drupal 8 ?

Memcache is caching server allow you to incrise and have great performence on your site. Drupal and memcached work very well and here the full tutorial you need to install and setup memcache server and your drupal instance.

Install Mamcache

sudo apt-get install memcached

Start and get details

#Start
service memcached start
#Get details
#01
service memcached status
#02
ps -eaf | grep memcached
#03
netstat -tap | grep memcached
#04 : Get full details
echo "stats settings" | nc localhost 11211

 

Memcache configuration

Memcached configuration file is located on :  /etc/memcached.conf
You can set the port, set memory size .... on this file.
    

Install PECL memcache packages

Chack :
php -m |grep mem
Install: (Not tested)
/usr/local/bin/pecl install memcache
Link : https://www.servint.net/university/article/the-tech-bench-how-to-install-php-memcache/

 

Setup Drupal tu use memcached instead of the database.

Edit the settings.php and add m configuration.

//Memcache configuration
$settings['memcache']['servers'] = ['127.0.0.1:11211' => 'default'];
$settings['memcache']['bins'] = ['default' => 'default'];
$settings['memcache']['key_prefix'] = '';

$settings['cache']['default'] = 'cache.backend.memcache';

 

How to check drupal using memcached not the database ?

1. TRUNCATE all tables start with cache_
2. Clear the cache using 'drush cr' or via interface.
-> If the tables start with cache_ does not contains any records, memcache is configured correctly. otherwise re check the configuration.
NOTE : Even correctly configured, Some times you can see 1 or two records in some tables. (memcache module is currently in development (Alpha version (2017/04/24)))

Tags

  • Drupal 8
  • Code
  • Cache
  • Server
  • Add new comment
Drupal 8 Cache API
Redis and Php-Redis with drupal 9 on Linux

Comments2

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.

Hamza Zia (not verified)

9 years 4 months ago

Memcache on Drupal 8

Very good writeup. Also checkout how you can install memcache on your Drupal 8 site

  • Reply
  • The Editor (not verified)

    9 years 4 months ago

    In reply to Memcache on Drupal 8 by Hamza Zia (not verified)

    In the present day, Memcache on Drupal 8 is an Alpha

    In the present day, Memcache on Drupal 8 is an Alpha Version. There for it is not recommended to use in production sites.

    • Reply

    Links

    • Drupal.org
    • Drupal core release cycle
    • Drupal events with ease
    • Unit test with Drupal using PHPUnit (Drupal 10)
    • Tokens for file upload url
    • Tips for Docker
    • CKEditor inline image files usage for custom forms.
    • Install Docker on Linux Mint
    • Install PHP 8.1
    • Drupal Security Best Practices
    • Order and sort items with tabledrag
    • Add a custom service YAML container
    • Apply a patch with composer