Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i need to install memcahced (not memcache) on my computer (ubuntu 10.10 and php 5.3.3), i did the follwoing:
$ apt-get install php5-memcached libmemcached-tools libmemcached5
$ pecl install memcached
it ends with the following error

checking for libmemcached location... configure: error: memcached support 
requires libmemcached. Use --with-libmemcached-dir= to specify the prefix 
where  libmemcached headers and library are located

any idea is highly appreciated

share|improve this question
up vote 3 down vote accepted

No need to use pecl. Install memcached extension module for PHP5:

 $ sudo apt-get install php5-memcached


        $m = new Memcached();
        $m->addServer('', 11211);

$ php test.php 
array(1) {
  array(24) {

To test memcached use telnet:

$ telnet 11211
Connected to
Escape character is '^]'.
STAT pid 2462
STAT uptime 1039
STAT time 1298284545
STAT version 1.4.5
STAT pointer_size 32
STAT rusage_user 0.092005
STAT rusage_system 0.000000
share|improve this answer
i did already... it keeps giving me RES_WRITE_FAILURE response code on set or add and gives "SOME ERRORS WERE REPORTED" on getstats – Alaa Alomari Feb 21 '11 at 10:24
@Alaa test connection to memcached – ooshro Feb 21 '11 at 10:36
using telnet: stats STAT pid 9012 STAT uptime 14 STAT time 1298285340 STAT version 1.2.6 STAT pointer_size 32 STAT rusage_user 0.000000 STAT rusage_system 0.000000 STAT curr_items 0 STAT total_items 0 STAT bytes 0 STAT curr_connections 2 STAT total_connections 3 STAT connection_structures 3 STAT cmd_get 0 STAT cmd_set 0 STAT get_hits 0 STAT get_misses 0 STAT evictions 0 STAT bytes_read 7 STAT bytes_written 0 STAT limit_maxbytes 1073741824 STAT threads 1 but why do i get errors when use PHP!! :(( – Alaa Alomari Feb 21 '11 at 10:51
Add output php -i memcached section – ooshro Feb 21 '11 at 11:09
Version 1.0.2, libmemcached version 0.40, Session support yes, igbinary support no – Alaa Alomari Feb 21 '11 at 11:37

I fixed this by installing libmemcached-devel (I'm on Centos 5.5)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.