It's important to remember that memcache and memcached are different things.
This script helps check if memcached is running on the server:
<?php
error_reporting(E_ALL|E_STRICT);
ini_set('display_errors', true);
$mem = new memcached();
$mem->addServer("127.0.0.1", 11211);
$result = $mem->get("Test");
if ($result) {
echo $result;
} else {
echo "Test key not found, adding... Refresh the page.";
$mem->set("Test", "Key found, memcached is working") or die("Failed...");
}
?>
- Instead of 127.0.0.1, insert the memcache server address or the path to the socket. Usually, 127.0.0.1 is sufficient.
- If a socket path is specified on the server, replace 11211 with 0.
Copy this script into a file named test.php, upload it to the website folder, and open it in a browser at yoursite.com/test.php