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
root@server [~]# service memcached start Starting memcached: [ OK ]
Then, install PHP memcache
# pecl install memcache
We can install memcache from the source by following the steps below:
# wget http://pecl.php.net/get/memcache
# cd memcache-3.0.8
Then, you can see something like this:
# phpize Configuring for: PHP Api Version: 20100412 Zend Module Api No: 20100525 Zend Extension Api No: 220100525
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