Viewing 4 replies - 1 through 4 (of 4 total)
  • Many Shared Hostings uses a UNIX socket, so try port 0 and set the path to memcached-1.sock or memcached.sock.

    Or try this code to check if Memcached uses UNIX socket.

    <?php
    $mc = new Memcached();
    $mc->addServer('path_to_memcached.sock or path_to_memcached-1.sock', 0) or die ("Unable to connect");
    
    echo "Server version:<pre>";
    print_r($mc->getVersion());
    echo "</pre>";
    
    $tmp = new stdClass;
    $tmp->str_attr = 'test';
    $tmp->int_attr = rand(0,1000);
    
    $mc->set('testkey', $tmp, 10) or die ("Unable to save data in the cache");
    
    $result = $mc->get('testkey');
    
    echo "Data from the cache:<pre>";
    var_dump($result);
    echo "</pre>";
    Thread Starter Anonymous User 14598057

    (@anonymized-14598057)

    i got respone Server version:Unable to save data in the cache

    Did you try both names for memcached.sock?

    Verify if server path to memcached.sock is correct.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Memcached test connection’ is closed to new replies.