Sunday, August 14, 2011

memcache installation

Installing Memcache in Cpanel server/ Linux Servers

Memcache is a memory caching system to get the memory for where you required more and it used your system memory to a better way

First we need to install the libeven. This API will helps to execute a callback functon when a specific event accure. This is useful when there is a timeout is occured for a particular process.

Installtion is covered in three steps

Step 1: Libevent
#cd usr/src/
#wget http://monkey.org/~provos/libevent-2.0.12-stable.tar.gz
#tar -xvf libevent-2.0.12-stable.tar.gz
#cd libevent-2.0.12-stable
#./configure
#make
#make install
: You have to note down the libeven installation location from the above installation. In most cases this will be on /usr/local/lib
Then you need to update the libeven shared libraries for that we want to edit the /etc/ld.so.conf.d
#vi /etc/ld.so.conf.d/libevent.conf --> /usr/local/lib
write and quit from this file
and execute the command
#ldconfig
# ldconfig -v |grep libevent
ibevent_pthreads-2.0.so.5 -> libevent_pthreads.so
libevent_openssl-2.0.so.5 -> libevent_openssl.so
libevent_core-2.0.so.5 -> libevent_core.so
libevent_extra-2.0.so.5 -> libevent_extra.so
libevent-2.0.so.5 -> libevent.so

Step 2 : memcache

Now we can install memcache
#cd /usr/src
#wget http://memcached.googlecode.com/files/memcached-1.4.6.tar.gz
#tar -xvf memcached-1.4.6.tar.gz
#cd memcached-1.4.6
#./configure
#make
#make install
You can confirm the memcache is stalled on your server using the command
#which memcached

Step3: Memcache for php module

#cd /usr/src
#wget http://pecl.php.net/get/memcache-2.2.6.tgz
#tar -xvf memcache-2.2.6.tgz
#cd memcache-2.2.6
#phpize
#./configure
#make
#make install
Installing shared extensions: /usr/local/lib/php/extensions/no-debug-non-zts-20060613/
Now we need to edit the php.ini for the memcache exention. Please confirm the above locaton is your default extension extension_dir. For my this is the same location in my php.ini
So I have added the line [ extension = "memcache.so" ] without the [ ] symbols.
write and quite the php.ini file and restarted the apache server
#/scripts/restartsrv_httpd
Now we can confirm memcache php module has been installed or now using the command
#php -m | grep memcache
and aso touch a info.php file and check the memcache module is listed or now

Thats it you have finished ...

No comments:

Post a Comment