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
[email protected] [~]# 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-3.0.8.tgz # tar -xvzf memcache-3.0.8.tgz # 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