Home  >  Article  >  Backend Development  >  php 无法连接 memcache解决方法

php 无法连接 memcache解决方法

WBOY
WBOYOriginal
2016-06-13 11:51:161042browse

php 无法连接 memcache

昨天在 linux 虚拟机装了一个 memcache,在 php 可以正常存取数据。 今天重启 linux, 却发现 php 无法连接memcache, 但 telnet 可以连接, 可以存取数据。 希望有大侠帮解答一下,解决问题,马上结贴,给意见、帮顶都给分。

我的 php 代码如下
$memcache = new Memcache; 
$memcache->connect('localhost', 11211);
$memcache->set('key', 'test'); 
$get_value = $memcache->get('key'); 
echo $get_value;

------解决方案--------------------
是不是端口没占了?
------解决方案--------------------
代碼正常。
telnet 成功可以表示端口正常。

telnet localhost 11211
set key 0 0 3
123
看看能否存儲。
------解决方案--------------------
无法连接。总会有错误信息的吧。贴出来瞅瞅。
------解决方案--------------------
求错误信息。
------解决方案--------------------
同求 你这没有错误信息  怎么破啊

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn