2

I have installed memcached on my Debian Wheezy box, it runs on 11211 port (I can telnet to it and get STATs), php extensions are installed (memcache & memcached) and I run this:

<?php
//error_reporting(E_ALL & ~E_NOTICE);

$mc = new Memcached();

var_dump($mc->getResultCode()); // returns 0

$result = $mc->addServer("localhost", 11211);

var_dump($result); // returns TRUE

var_dump($mc->getStats()); // returns nulled stats

$result = $mc->set("foo", "Hello!");

var_dump($mc->getResultCode()); // returns MEMCACHED_SERVER_TEMPORARILY_DISABLED

echo $mc->set("bar", "Memcached...");

var_dump($mc->getResultCode());


$arr = array(
     $mc->get("foo"),
     $mc->get("bar")
 );
var_dump($arr);
?>

I've tried to run memcached deamon as the current website owner (-u www-data in /etc/memcache) but it doesn't help and I can't find anything usable about this MEMCACHED_SERVER_TEMPORARILY_DISABLED code. Any ideas what might be broken / misconfigured?

I'm using PHP 5.4 + nginx 1.5.8 + eAccelerator.

Danack
  • 24,939
  • 16
  • 90
  • 122
Bartosz Wójcik
  • 1,079
  • 2
  • 13
  • 31
  • 4
    Try 127.0.0.1 or ::1 if using ipv6. Localhost is a special name that doesn't always work as you would hope. – Danack Jan 15 '14 at 14:12
  • damn... so stupid :), it works, I didn't even thought about it when I was looking at the code, thank you Danack! – Bartosz Wójcik Jan 15 '14 at 14:21
  • possible duplicate of [mysql\_connect (localhost / 127.0.0.1) slow on Windows platform](http://stackoverflow.com/questions/11663860/mysql-connect-localhost-127-0-0-1-slow-on-windows-platform) – Danack Jan 15 '14 at 15:18

0 Answers0