Object Cache “Connection Test: Failed”

Hi, I have multiple sites running on seperate shared hosting accounts on Stablehost which runs LiteSpeed Servers.

I had the Litespeed-Cache WP plugin + Object Cache (Memcached) working for a few months without issues, and this week I noticed Memcached can’t connect.

PHP Version: 8.1.22
Server API: LiteSpeed V8.1 Cloudlinux 1.3
Memcached Version: 3.1.5
libmemcached version: 1.0.18

Status
Memcached Extension: Enabled
Redis Extension: Disabled
Connection Test: Failed (Learn More)

Host: localhost
Port: 11211

I went to Learn More and setup the Test file to connect to Memcached.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

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

echo '<hr>';

$key = "test_key";
$value = "Hello, Memcached!";
$expiration = 3600;

try {
    // Set value:
    $m->set($key, $value, $expiration);
    
    // Read value:
    if ($m->get($key)) {
        echo "Value successfully set in Memcached.";
    } else {
        echo "Failed to set value in Memcached.";
    }
} catch (Exception $e) {
    echo "An error occurred: " . $e->getMessage();
}

Results:

Array ( [0] => Array ( [host] => localhost [port] => 11211 [type] => TCP ) )
Failed to set value in Memcached.
  • Connection seems to be established and returns a list that contains 1 server.
  • But when I expanded script with set/get, it fails to return the value, so seems that value isn’t being set.
  • PHP doesn’t throw any errors.

I contacted Stablehost and asked them to restart the Memcached server, to which they told me (1) they can’t restart Memcached on a shared host, and (2) to contact the plugin creator.

I said: that doesn’t make sense, because even without the plugin, I can’t connect to Memcached. To which they wasted my time by making me wait an hour saying “I’m looking into it”, and when I left, told me to contact the plugin creator.

Do you have any idea what could be wrong?

To me looks like Memcached is blocked/frozen and needs a restart, but I wanted to double-check with you.

This isn’t even just one website, (1) it’s all my WordPress websites on this one shared account, and (2) I also manage a second account on Stablehost in WordPress + LiteSpeed-Cache and it has the same issue now. So it’s a cross-account problem at this point.

It’s a Stablehost server issue, right?

I tried using Redis and I’m getting the same issue there as well (I know it says Disabled here, but I only Enable either-or, turned it off after it wasn’t working).

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer