1

Here is my test code:

$host = 'localhost';
$port = '11211';

if (extension_loaded('memcached')) {
    $mc = new Memcached;
    $mc->addServer($host, $port);
    if ($mc->set('test', 'TEST')) {
        echo 'true';
    } else {
        echo $mc->getResultCode();
        echo $mc->getResultMessage();
    }
} else {
    echo 'no_memcached';
}

The output is:

47 SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY

SELinux is disabled, I've also tried to turn off tcp_nodelay in nginx.conf and tried different types of host (127.0.0.1 and localhost) and ports.

I've read this question - How to debug memcached "SERVER HAS FAILED AND IS DISABLED UNTIL TIMED RETRY" errors?

But nothing helped and I cannot comment, because I have not enough points.

1

2 Answers 2

1

It can be different problems why it's not run.

In my case, I realized that memcached service is not started in docker container.

So, first - check if memcached actually works and check it logs. Try to connect to memcached (on default location)

telnet localhost 11211
1
  • lsof -i -P :11211 will get better results
    – djdomi
    Aug 5, 2021 at 14:59
0

The solution was simple.

Memcached was installed as a PHP module, but not as a Debian extension.

To install it, just run two commands:

sudo apt update
sudo apt install memcached

Done. All works now.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .