php安裝memcacheq

zchd發表於2014-08-19
berkeley:
http://download.oracle.com/otn/berkeley-db/db-6.1.19.tar.gz?AuthParam=1408431634_4887d44685da5a09c70e30bd7d933861
memcacheq:
https://codeload.github.com/stvchu/memcacheq/zip/master

./configure –with-libevent –with-bdb=/usr/local/berkeleydb/ –enable-threads –prefix=/usr/local/memcacheq

/usr/local/memcacheq/bin/memcacheq -h

問題:

/usr/local/memcacheq/bin/memcacheq: error while loading shared libraries: libdb-6.1.so: cannot open shared object file: No such file or directory

解決 :

sudo ln -s /usr/local/berkeleydb/lib/libdb-6.1.so /usr/lib/

ldconfig

sudo /usr/local/memcacheq/bin/memcacheq -d -uwww -r -p11212 -H /data/mcq -N -R -v -L 1024 -B 1024 > /home/wwwlogs/mq_error.log

telnet 127.0.0.1 11212

$memcache_obj = new Memcached;

$memcache_obj->addServer(`127.0.0.1`,11212);
$memcache_obj->set(`int`,9);
$a = $memcache_obj->get(`int`);
var_dump($a);
$a = $memcache_obj->get(`int`);
var_dump($a);
result:
[jackluo@localhost mcq]$ php memcacheq.php
int(9)
bool(false)

$m = new Memcached;

$m->addServer("127.0.0.1",11212);


$m->set("mailq","zhangsan");
$m->set("mailq","lisi");
$m->set("mailq","wangwu");

print "------push bellow into mailq queue------ ";
print "zhangsan ";
print "lisi ";
print "wangwu ";
print "------get mailq from mailq queue------ ";
print "first:".$m->get("mailq")." ";
print "second:".$m->get("mailq")." ";
print "third:".$m->get("mailq")." ";
print "fourth:".$m->get("mailq");