poper168 发表于 2013-05-02 17:16

memcahed扩展安装成功,但是get,set的时候不起作用不知道为什么?

xuxq@dev:~/memcached$ php-5.3 -m

bcmath
Core
ctype
curl
date
dom
ereg
fileinfo
filter
gd
gearman
gmagick
hash
iconv
json
libxml
mbstring
mcrypt
memcache
memcachedxuxq@dev:~/memcached$ ps aux|grep memcached
nobody    25220.00.0213641484 ?      S    15:27   0:00 /usr/bin/memcached -m 64 -p 11211 -u nobody -l 127.0.0.1
nobody    46660.00.0223882156 ?      Ss   15:27   0:00 /usr/bin/memcached -d -m 128 -p 21212 -u nobody
nobody    46680.00.0213641020 ?      Ss   15:27   0:00 /usr/bin/memcached -d -m 128 -p 21213 -u nobody
nobody    46700.00.0213641016 ?      Ss   15:27   0:00 /usr/bin/memcached -d -m 128 -p 21215 -u nobody
nobody    46720.00.0213641016 ?      Ss   15:27   0:00 /usr/bin/memcached -d -m 128 -p 21216 -u nobody
nobody    46740.00.0213641016 ?      Ss   15:27   0:00 /usr/bin/memcached -d -m 128 -p 21217 -u nobody
nobody    46760.00.0223882144 ?      Ss   15:27   0:00 /usr/bin/memcached -d -m 128 -p 21218 -u nobody
nobody    46780.00.0213641012 ?      Ss   15:27   0:00 /usr/bin/memcached -d -m 128 -p 21219 -u nobody
xuxb      95430.00.0   7076   832 pts/7    R+   17:14   0:00 grep memcached
global_config.php<?php
$g_memcached = array();
$g_memcached['test'][] = array('host'=>'127.0.0.1', 'port'=>21212, 'weight'=>1);
$g_memcached['test'][] = array('host'=>'127.0.0.1', 'port'=>21218, 'weight'=>1);
test2.php<?php
require_once ('global_config.php');

$memd = new Memcached;
$memd->addServer($g_memcached['test']['host'], $g_memcached['test']['port'], $g_memcached['test']['weight']);

for($num = 1; $num < 99; $num++){
        $memd->set('test2'.$num, 'ceshi0000099999', 0);
        $value = $memd->get('test2'.$num);
        print "test2".$num." => $value\n";
}执行结果:xuxq@dev:~/memcached$ php-5.3 test2.php
test21 =>
test22 =>
test23 =>
test24 =>
test25 =>
test26 =>
test27 =>
test28 =>
test29 =>
test210 =>
test211 =>

maochanglu 发表于 2013-05-03 09:08

先用命令行下的客户端。试试memcached 运行正常不。

poper168 发表于 2013-05-04 17:14

bikong0411 发表于 2013-05-03 08:44 static/image/common/back.gif
set完打印出来set的结果看看

请仔细看下我的代码,我就是set完之后打印的。
同样的代码在别人的机器上执行是可以的。我觉得就是扩展安装的有问题。可我按装扩展的时候没有任何报错啊。

poper168 发表于 2013-05-04 17:15

maochanglu 发表于 2013-05-03 09:08 static/image/common/back.gif
先用命令行下的客户端。试试memcached 运行正常不。

我用telnet方式访问memcache是没有问题的

linux_c_py_php 发表于 2013-05-07 10:55

检查一下set返回值

bikong0411 发表于 2013-05-03 08:44

set完打印出来set的结果看看
页: [1]
查看完整版本: memcahed扩展安装成功,但是get,set的时候不起作用不知道为什么?