Thursday, February 3, 2011

Install and set php extention Memcached

yum install gcc gcc-c++


Install the dependency libevent

cd /usr/local/src
curl -O http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz
tar xzvf libevent-1.4.14b-stable.tar.gz
cd libevent-1.4.14b-stable
./configure --prefix=/usr/local
make && make install


Next, install memcached:

cd /usr/local/src
curl -O http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
tar xzvf memcached-1.4.5.tar.gz
cd memcached-1.4.5
LDFLAGS='-Wl,--rpath /usr/local/lib' ./configure --prefix=/usr/local
make && make install


Lets install the new PECL memcached extension in your web server. This new extension depends on libmemcached. You can grab the latest distribution of libmemcached from https://launchpad.net/libmemcached and compile it in your own machine. Make sure you have the dependencies met.

cd /usr/local/src
wget http://launchpad.net/libmemcached/1.0/0.44/+download/libmemcached-0.44.tar.gz
tar -zxvf libmemcached-0.44.tar.gz
cd libmemcached-0.44
./configure
make && make install


Considering everything went fine, lets install the PECL memcached extension

pecl install memcached


Build process completed successfully
Installing '/usr/lib64/php/modules/memcached.so'
install ok: channel://pecl.php.net/memcached-1.0.2
configuration option "php_ini" is not set to php.ini location
You should add "extension=memcached.so" to php.ini

No comments: