Memcached get function always returns 'bool (false)'

Memcached must be installed correctly. I am using php 5.4

memcached settings

With this code, I should get "99" as a result, but in the end we get "bool (false)".

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

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

  var_dump($m->get('int'));
+1
source share
1 answer

This was asked a long time ago, but still takes place in a Google search, so the answer may be useful for those who are looking for the answer to this question.

Check if Memcached is installed.

Run the command telnet 127.0.0.1 11211, and if the connection fails, you need to install Memcached or check if your firewall allows the connection of port 11211.

For Ubuntu Team sudo apt-get install memcached

0
source

All Articles