0

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?

asked Nov 13, 2017 at 10:30

1 Answer 1

1

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).

$ php -m | grep memcached
answered Nov 13, 2017 at 10:37

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.