How to install Memcached on CentOS (with DirectAdmin installed) + Memcache PECL

By BXTra |

I just want to try if Memcached can really help my server load or not. So, I look around to find the way how to do it. There are a couple ways but to me, below are what I did to installed it.

Get Libevent which is require to install Memcached. Their homepage is here ->

tar -xvf libevent-1.4.13-stable.tar.gz
cd libevent-1.4.13-stable
./configure;make;make install;

Then, get Memcached from

gunzip memcached-1.4.5.tar.gz
tar -xvf memcached-1.4.5.tar
cd memcached-1.4.5
./configure;make;make install;

For me, I got an error below :

error while loading shared libraries: cannot open shared object file: No such file or directory

So, I did steps below :

nano /etc/

Then, enter into the textbox


Then, CTRL+O to save, CTRL+X to exit.

Then, run


Once you're done with that, try run

memcached -d -u nobody -m 1024 -p 11211

This is not done yet, you need to let PHP knows to be able to use memcached.

gzip -df memcache-2.2.5.tgz
tar -xvf memcache-2.2.5.tar
cd memcache-2.2.5
./configure;make;make install;

Then, edit php.ini file. Add line below into the file

extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20060613"

Then, restart HTTP and check PHP Status.. You will see Memcached info as below:

Now, you're done install Memcached on the server. However, to really make use of it, you need to modify some code in your website. If you don't. You don't really make use of Memcached.

Server Information - Software
- CentOS 5.4
- DirectAdmin 1.351
- Apache 2.2.15
- PHP 5.2.13
- MySQL 5.1.45


Source :

Hi, Thanks for the detailed explaination, however, I still can't get this installed. I don't get any errors, just not showing in phpinfo. I think the Direct Admin is really screwing these otherwise simple installs up.

I managed to get my APC working by using the following lines in php.ini: extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20060613/

Add new comment

  • No HTML tags allowed.
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.