• Resolved Mikey

    (@mikeyhash)


    Hi,

    The connection test appears as Failed for my Object Cache setting (Memcached). Please see https://prntscr.com/mpdfl8

    I’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?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support qtwrk

    (@qtwrk)

    Hi,

    If you have SSH access, please try command telnet 127.0.0.1 11211

    If 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,

    Thread Starter Mikey

    (@mikeyhash)

    @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?

    Plugin Support qtwrk

    (@qtwrk)

    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,

    Thread Starter Mikey

    (@mikeyhash)

    Thank you.

    The output:

    Get key1 value: 
    Get key1 value: 
    Get key2 value: 
    Get key1 value: 
    Get key2 value: 
    Plugin Support qtwrk

    (@qtwrk)

    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,

    Thread Starter Mikey

    (@mikeyhash)

    Ok, thank you. I will contact my hosting provider.

    Thread Starter Mikey

    (@mikeyhash)

    @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 6 years ago by Mikey.
    Plugin Support qtwrk

    (@qtwrk)

    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

    Thread Starter Mikey

    (@mikeyhash)

    @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”.

    • This reply was modified 6 years ago by Mikey.
    • This reply was modified 6 years ago by Mikey.
    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    Could you please submit a ticket here? we will dig it deeper.

    Please turn it off for the time being.

    Best regards,

    • This reply was modified 6 years ago by qtwrk.
    Thread Starter Mikey

    (@mikeyhash)

    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.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Object Cache Connection Test’ is closed to new replies.