I'm getting the below error when I run the following PHP:
$mem = new Memcached();
$mem->addServer("127.0.0.1", 11211);
$result = $mem->get("blah");
if ($result) {
echo $result;
} else {
echo "No matching key found. I'll add that now!";
$mem->set("blah", "I am data! I am held in memcached!") or die("Couldn't save anything to memcached...");
}
And the error:
[Mon Nov 13 10:14:44.751598 2017] [proxy_fcgi:error] [pid 8091:tid 140212336183040] [client 127.0.0.1:39055] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught Error: Class 'Memcached' not found in /opt/bitnami/apps/magento/htdocs/cache-test.php
I ran
ps wuax | grep memcached
And can see Memcached on localhost 11211.
Just trying to configure Memcached to control all the session files in Magento 2 and was running a test to seem if it is all configured properly. If Memcached is installed then why the error, could anybody point me in the right direction?
Best Answer
Check if you have the memcached extension installed and enabled for the php version that you're using. Also if it is correctly configured in the php.ini file (it could be looking in the wrong directory).