memcached get function always returns 'bool(false)'

萝らか妹 提交于 2019-12-11 06:21:19

问题


Memcached should be installed correctly. I'm using php 5.4

memcached settings

With this code I should get '99' as a result but I end up with 'bool(false)'.

  $m = new Memcached();
  $m->addServer('localhost', 11211);

  $m->set('int', 99);

  var_dump($m->get('int'));

回答1:


This has been asked long ago, yet ranks up at Google search so the answer might be helpful for someone looking for the answer to this question.

Check if Memcached is really installed

Run the command telnet 127.0.0.1 11211 and if the connection fails then you need to install Memcached or check if your Firewall allows the port 11211 connections.

For Ubuntu, the command is sudo apt-get install memcached



来源:https://stackoverflow.com/questions/34228958/memcached-get-function-always-returns-boolfalse

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!