Install Memcached
sudo yum -y install memcached
sudo yum -y install memcached
sudo vim /etc/sysconfig/memcached
Add check and alter below settings on it --
PORT=”11211″
USER=”memcached”
MAXCONN=”1024″
CACHESIZE=”64″
OPTIONS=”-l 127.0.0.1”
USER=”memcached”
MAXCONN=”1024″
CACHESIZE=”64″
OPTIONS=”-l 127.0.0.1”
sudo systemctl enable memcached
sudo systemctl restart memcached
Install Memcached PHP
Extension
There
are two different extensions for it namely ‘memcache’ and ‘memcahed’. We are
using memcahe here.
yum -y install php-pecl-memcache
Check memcached server
sudo yum -y install nc
watch "echo stats | nc 127.0.0.1 11211"
Check php extension (memcache)
php -m | grep -i "memcache"
Enable drupal memcache module
$conf['cache_backends'][] = 'sites/all/modules/memcache/memcache.inc';
$conf['lock_inc'] = 'sites/all/modules/contrib/memcache/memcache-lock.inc';
$conf['memcache_stampede_protection'] = TRUE;
$conf['cache_default_class'] = 'MemCacheDrupal';
$conf['cache_class_cache_form'] = 'DrupalDatabaseCache';
$conf['memcache_key_prefix'] = 'unique_key';
?>
Put your site back in on-line mode and you’re done! Memcache
also ships with memcache_admin module which you can enable to view the
statistical reports on it. This is only used for development purpose.
Troubleshoot:
If you are facing issues to connect Memcache from your
browser then give Memcache access to apache:
setsebool -P httpd_can_network_memcache 1