Upgrade Your Drupal Skills
We trained 1,000+ Drupal Developers over the last decade.
See Advanced Courses NAH, I know EnoughInstall Memcache for Drupal on CentOS 5.5
Parent Feed:
Install EPEL Repo
Memcache can be found in the EPEL repo. Install EPEL repo:
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
Install Memcache
yum install memcached pecl install memcache yum install zlib-devel
Auto start memcache on reboot
chkconfig --level 2345 memcached on
Add PHP settings for Memcache
nano /etc/php.d/memcache.ini
extension=memcache.so memcache.hash_strategy="consistent"
Start Memcache and Apache
/etc/ini.d/httpd restart /etc/init.d/memcached start
Memcache Check
Check if memcache module is loaded in php
php -i | grep memcache
You should see an output similar to this:
/etc/php.d/memcache.ini, memcache memcache support => enabled memcache.allow_failover => 1 => 1 memcache.chunk_size => 8192 => 8192 memcache.default_port => 11211 => 11211 memcache.default_timeout_ms => 1000 => 1000 memcache.hash_function => crc32 => crc32 memcache.hash_strategy => consistent => consistent memcache.max_failover_attempts => 20 => 20 Registered save handlers => files user memcache
done ;)
Memcache Drupal settings
- Download and install the Drupal memcache module
- Update your settings.php file
$conf = array( // The path to wherever memcache.inc is. The easiest is to simply point it // to the copy in your module's directory. 'cache_inc' => './sites/all/modules/memcache/memcache.inc', // or // 'cache_inc' => './sites/all/modules/memcache/memcache.db.inc', ); $conf = array( 'memcache_servers' => array('localhost:11211' => 'default', 'localhost:11212' => 'pages'), 'memcache_bins' => array('cache_page' => 'pages'), );
Further reading:
Memcache API and Integration
Installing Memcached on RedHat or CentOS
Related blog posts:
About Drupal Sun
Drupal Sun is an Evolving Web project. It allows you to:
- Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
- Facet based on tags, author, or feed
- Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
- View the entire article text inline, or in the context of the site where it was created
See the blog post at Evolving Web