how to install pecl memcached?
11,024
Solution 1
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
Solution 2
I fixed this by installing libmemcached-devel (I'm on Centos 5.5)
Related videos on Youtube
Author by
Alaa Alomari
Updated on September 17, 2022Comments
-
Alaa Alomari over 1 year
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 errorchecking 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
-
Alaa Alomari about 13 yearsi did already... it keeps giving me RES_WRITE_FAILURE response code on set or add and gives "SOME ERRORS WERE REPORTED" on getstats
-
ooshro about 13 years@Alaa test connection to memcached
-
ooshro about 13 yearsAdd output
php -i
memcached section -
Alaa Alomari about 13 yearsVersion 1.0.2, libmemcached version 0.40, Session support yes, igbinary support no
-
ooshro about 13 yearsadd output: php -r '$m = new Memcached(); $m->addServer("127.0.0.1", 11211); var_dump($m->getStats());'
-
Alaa Alomari about 13 yearsPHP Warning: Module 'memcache' already loaded in Unknown on line 0 array(1) { ["127.0.0.1:11211"]=> array(24) { ["pid"]=> int(9012) ["uptime"]=> int(8118) ["threads"]=> int(1) ["time"]=> int(1298293444) ["pointer_size"]=> int(32) ["rusage_user_seconds"]=> int(0) ["rusage_user_microseconds"]=> int(172010) To be Continued in the next comment
-
Alaa Alomari about 13 years["rusage_system_seconds"]=>int(0) ["rusage_system_microseconds"]=> int(244015) ["curr_items"]=> int(0) ["total_items"]=> int(0) ["limit_maxbytes"]=> int(1073741824) ["curr_connections"]=> int(2) ["total_connections"]=> int(4) ["connection_structures"]=> int(3) ["bytes"]=> int(0) ["cmd_get"]=> int(0) ["cmd_set"]=> int(0) ["get_hits"]=> int(0) ["get_misses"]=> int(0) ["evictions"]=> int(0) ["bytes_read"]=> int(37) ["bytes_written"]=> int(472) ["version"]=> string(5) "1.2.6" } }
-
Alaa Alomari about 13 yearsit seems the problem was with my apache!! even i restarted it before.. but now,, i restarted it, and it works fine... Thanks alot ooshro. i really appreciate your time and help