Skip to content

Compile Memcache and Memcached in Centos

June 30, 2012

1.First we get source files
wget https://memcached.googlecode.com/files/memcached-1.4.13.tar.gz
wget http://downloads.sourceforge.net/project/levent/libevent/libevent-2.0/libevent-2.0.19-stable.tar.gz

2.Compile libevent
tar -zxvf libevent-2.0.19-stable.tar.gz
cd libevent-2.0.19-stable
./configure
make && make install

Also you can install libevent-devel and libevent package

3.Compile memcached
tar -zxvf memcached-1.4.13.tar.gz
cd memcached-1.4.13
./configure –prefix=/opt/memcached –with-libevent
make && make install

4.Start memcached
cd /opt/memcached/bin
./memcached -d -m 256 -p 11211 -u root
-d daemon, -m ram, -p port default is 11211, -u user

if you get a error “cant find libevent” try this
cp -R /usr/local/lib/libevent* /usr/lib64/

5.Install php memcache extension
wget http://pecl.php.net/get/memcache
cd memcache-3.0.6
whereis php-config
whereis phpize
phpize && ./configure –enable-memcache –with-php-config=/usr/local/bin/php-config
make && make test && make install
vi /usr/local/lib/php.ini

extension_dir = “/usr/local/lib/php/extensions/no-debug-zts-20060613/”
extension = “memcache.so”
Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: