Knowledgebase
Knowledgebase
Memcached Install on cPanel/WHM Servers
Posted by Will Kruss on 26 May 2016 10:44 PM

A complete guide on how to install Memcache on a cPanel/WHM server with root access. Follow step by step tutorial to learn fast.

Memcached is a free & open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. It is highly recommended for use on servers that utilise MySQL/MySQLi in high load environments using carts such as Magento.

After installing Memcached you would need to enable it within your CMS application. For Magento see: http://magebase.com/magento-tutorials/speeding-up-magento-with-apc-or-memcached/

For older cPanel installation there are further instructions can be found from a post by David Ado and has been tested and works perfectly. Please visit: http://www.davidado.com/2012/09/07/install-memcached-in-a-whmcpanel-environment-centos/ for full instructions on the installation of Memcached on older cPanel installations.

For Memcached installation on up to date cPanel please see below:

SSH into your server

# yum install memcached

Then, start memcached service

# service memcached start

Example:

root@server [~]# service memcached start
Starting memcached: [ OK ]

Then, install PHP memcache

# pecl install memcache

OR

We can install memcache from the source by following the steps below:

# wget http://pecl.php.net/get/memcache
# cd memcache (hit tab to fill out the version number)
# phpize

Then, you can see something like this:

# phpize
Configuring for:
PHP Api Version:         20100412
Zend Module Api No:      20100525
Zend Extension Api No:   220100525
# ./configure
# make
#make install

Make sure memcache module is present in php.ini file. If not, add the memcache extension in php.ini file.

# echo "extension=memcache.so" >> /usr/local/lib/php.ini

Finally, restart Apache

# service httpd restart

Make sure memcached will be up even after a server reboot:

# chkconfig --levels 235 memcached on

How to check if memcache is installed or not?


root@server [~]# php -m | grep memcache
memcache

That’s it!!!

 

 
(4 vote(s))
Helpful
Not helpful