Object Cache Connection Test
-
Hi,
The connection test appears as
Failedfor my Object Cache setting (Memcached). Please see http://prntscr.com/mpdfl8I’ve read all the instructions in your official guidelines, but they beat me. I’m not a pro in this stuff and can’t really figure it out.
Can you please help on how to make it work?
-
Hi,
If you have SSH access, please try command
telnet 127.0.0.1 11211If you don’t have SSH access, please create a PHP file , with following code and access it , see what is output ?
<?php $mem = new Memcached(); $mem->addServer("127.0.0.1", 11211); //$mem->connect("127.0.0.1", 11211); $mem->set('key1', 'This is first value', 60); $val = $mem->get('key1'); echo "Get key1 value: " . $val ."<br />"; $mem->replace('key1', 'This is replace value', 60); $val = $mem->get('key1'); echo "Get key1 value: " . $val . "<br />"; $arr = array('aaa', 'bbb', 'ccc', 'ddd'); $mem->set('key2', $arr, 60); $val2 = $mem->get('key2'); echo "Get key2 value: "; print_r($val2); echo "<br />"; $mem->delete('key1'); $val = $mem->get('key1'); echo "Get key1 value: " . $val . "<br />"; $mem->flush(); $val2 = $mem->get('key2'); echo "Get key2 value: "; print_r($val2); echo "<br />"; $mem->close();Best regards,
@qtwrk, thank you for your response.
Can you please be more specific? Again, I’m not a php developer, although not a complete noob either.
As far as I’ve looked into it, it appears that I do not have SSH Access in my cpanel.
Thus, I’ve created the .php file containing your code above. But…what exactly do I have to do with it? Where do I save it and how do I access it?
Hi,
If you are using cPanel:
1. login cPanel , go to file manage
2. in /public_html/ folder , create a new file , namely “test.php”
3. copy the above code and save it
4. access it by https://your_domain/test.php
5. paste the output of it.
Best regards,
Thank you.
The output:
Get key1 value: Get key1 value: Get key2 value: Get key1 value: Get key2 value:Hi,
That means your server doesn’t have memcached
the object cache consisted by 2 parts.
1. PHP extension , which is you see in LSCWP page what it says “enabled”, this is the middle-way-component that communicates between PHP and memcached backend
2. the memcached daemon , where stores your objects.
Your server has part 1, but doesn’t have part 2.
You should contact your hosting provider and ask them if they provide memcached or not.
Best regards,
Ok, thank you. I will contact my hosting provider.
@qtwrk, I have contacted my provider and they only use Redis, not Memcached.
With Redis, the connection seems to work, but I need to do a few more tests.
Can you please give me a similar .php snippet as to the previous one for Memcached, so I could test the output for Redis?
Thank you very much.
-
This reply was modified 7 years, 3 months ago by
Mikey.
Hi,
Just googled out this one
<?php //Connecting to Redis server on localhost $redis = new Redis(); $redis->connect('127.0.0.1', 6379); echo "Connection to server sucessfully"; //check whether server is running or not echo "Server is running: ".$redis->ping(); ?>you should see output as
Connection to server sucessfullyServer is running: +PONG
Best regards
@qtwrk, thank you.
Please note that I have encountered a very big issue with Object Cache enabled: Users cannot add products to cart. Basically, you add a product and right after that it says “Your cart is empty” and thus you cannot complete an order.
When Object cache is disabled, everything goes back to normal.
Is there something I need to further configure in order to not have this issue? I can’t figure if there is some “wc cart object” to exclude in “Do Not Cache Groups”.
Hi,
just wanted to let you know that I’ve submitted a ticket yesterday.
Thanks.
Hello, I encountered the same error, when activating the “memcached” function my cart has not changed. When the “memcached” function is turned off, my cart works normally.
-
This reply was modified 7 years, 3 months ago by
The topic ‘Object Cache Connection Test’ is closed to new replies.