This post walks through the steps needed to install the libevent, memcached and PECL memcache libraries on our server (Fedora).
1) Install libevent
a) fetch the files on monkey.org
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
b) tar zxvf libevent-1.4.13-stable.tar.gz
c) ./configure –prefix=/usr/local
we are requesting libevent to install itself under /usr/local/lib/. When we compile memcached, we need to point it to the correct location as well.
d) make
e) make install
2) Install Memcached
a) Download the file from memcached website
wget http://memcached.googlecode.com/files/memcached-1.4.5.tar.gz
b) tar zxvf memcached-1.4.5.tar.gz
c) ./configure –with-lib-event=/usr/local/
d) make
e) Make install
I then ran into the following error, when testing "memcached" command line
error while loading shared libraries: libevent-1.4.so.2: cannot open shared object file: No such file or director
libevent needs to be registered..
3) Register libevent
a) create the file /etc/ld.so.conf.d/libevent-i386.conf
b) add the following line
/usr/local/lib/
c) save the file, and reload configuration:
ldconfig
You can then test memcached with the following command line, which starts the daemon:
memcached -d -u apache -m 1024 -l 124.0.0.1 -p 11211
d) you want to ensure that the daemon starts automatically each time you reboot the server: create /etc/rc.d/init.d/memcached
e) add the following lines to the file and save:
#!/bin/sh -e
memcached -d -u apache -m 1024 -l 124.0.0.1 -p 11211
You are now ready to use memcached with PHP
4) Install the PECL extension
a) Get the latest memcache package from PECL directory
wget http://pecl.php.net/get/memcache-2.2.5.tgz
b) tar zxvf memcache-2.2.5.tgz
c) cd memcache-2.2.5
d) phpize
e) ./configure
f) make && make install
g) add the following extension in php.ini
extension=memcache.so
.... And restart the server.
0 comments:
Post a Comment