Easy way to install Memcached and memcache in a cPanel server

In website hosting industry, speed is one of the most important factor that we prefer. The website speed depends upon many factors. Ofcourse, the speed of the website depends upon the plugins or other third party application installed with it. Other than the plugins, it mainly depends upon the server performance. Server can be tuned according to our requirement. Enabling caching is one of the factor that includes in optimizing a webserver. Caching technology is a main paramter. Memcache is a popular type of caching method used. Memcache is an open source caching system to speed-up dynamic website applications. For the proper functioning of Memcache, its daemon memcached is needed. Here I am explaining the installation steps of Memcache and Memcahed in the server.

Memcache is a type of caching. memcached daemon is needed for the functioning of Memcache. For that, first we need to install memcached daemon.

# yum install memcached

Then, start memcached service

# service memcached start

Example:

[email protected] [~]# 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-3.0.8
# 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?


[email protected] [~]# php -m | grep memcache
memcache

That’s it!!!

Some other Installations on cPanel server:
Softaculous
nginx as reverse proxy
Suhosin Patch
snoopy logger

Heba Habeeb

Working as a Linux Server Admin, Infopark, Cochin, Kerala.

You may also like...

13 Responses

  1. Fauzan Ariffin says:

    Good easy to follow guide! Thanks!

  2. onesoftidiana says:

    i’m on a shared hosting, can I install memcached ? If yes, then where do I need to write these codes that you have mentioned above. ?

  3. Sheri says:

    This is perfect! Just what I needed! Thank you for your clear instructions.

  4. Gustavo says:

    Great tutorial, thanks a lot!

  5. MassimoDIFA says:

    Yes perfect!! I was in trouble with php memcache, # pecl install memcache solved the problem!!
    Thank’s!!!

  6. Alfonso says:

    Thanks , it’s just what I was looking for.

  7. Neoshinji says:

    Very clear and clean explanation, only one word to name “Excellent!”
    You are the king 😉

Leave a Reply

Your email address will not be published. Required fields are marked *