1

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

2 Answers 2

3

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
9
  • i did already... it keeps giving me RES_WRITE_FAILURE response code on set or add and gives "SOME ERRORS WERE REPORTED" on getstats Feb 21, 2011 at 10:24
  • @Alaa test connection to memcached
    – ooshro
    Feb 21, 2011 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!! :(( Feb 21, 2011 at 10:51
  • Add output php -i memcached section
    – ooshro
    Feb 21, 2011 at 11:09
  • Version 1.0.2, libmemcached version 0.40, Session support yes, igbinary support no Feb 21, 2011 at 11:37
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .