Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.


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
=>DONE SUCESSFULLY
$ 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

2 Answers 2

up vote 2 down vote accepted

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

 $ sudo apt-get install php5-memcached

test.php:

<?php
        $m = new Memcached();
        $m->addServer('127.0.0.1', 11211);
        var_dump($m->getStats());
?>

$ php test.php 
array(1) {
  ["127.0.0.1:11211"]=>
  array(24) {
    ["pid"]=>
    int(2462)
    ["uptime"]=>
    int(129)

To test memcached use telnet:

$ telnet 127.0.0.1 11211
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
stats
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

 
discard

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.