Ready to get started?Download WordPress


Memcached Object Cache
Memcached with Unix socket (6 posts)

  1. guiribeiro
    Posted 1 year ago #

    Hi there,

    I'm using Memcached with Unix socket on a single site VPS. I would like to know if I can make this plugin work with Unix socket instead of TCP... any ideas?



  2. laowang1
    Posted 1 year ago #

    I would also like to know.

  3. laowang1
    Posted 1 year ago #

    I add line in wp-config.php
    $memcached_servers = array(
    'default' => array(

    then get error log:
    "NOTICE: PHP message: PHP Warning: MemcachePool::add(): php_network_getaddresses: getaddrinfo failed: No address associated with hostname in /wp-content/object-cache.php on line 121"

  4. novazembla
    Posted 10 months ago #

    Just stumbled over this post. It's a bit late but for future reference ...

    $memcached_servers = array(
      'default' => array(

    Works for me. Think the tripple slash is the secret sauce :-)

  5. wp-buddy
    Posted 8 months ago #

    Hey guys,
    the PHP documentation says that if when sockets are used you have to set the port to 0.

    So something like this in wp-config.php could help:

    $memcached_servers = array(
      'default' => array(

    But I didn't get it to work either :(

  6. philipnet
    Posted 6 months ago #

    The code at line 374:
    list ( $node, $port ) = explode(':', $server);
    splits the string 'unix:///tmp/memcached.socket:0' into 'unix' and '///tmp/memcached.socket:0'

    It then compares '///tmp/memcached.socket:0' to a numerical port number (which is not true) and so sets the port to '11211' and then tries to connect to 'unix:11211', which fails.

    The revised code here:
    list ( $host, $node, $port ) = explode(':', $server);
    if ( $host == "unix" )
    { $node = "unix:" . $node; }
    { $port = $node;
    $node = $host; }

    fixes it for socket connections to Memcache.

    TCP connections to Memcache should remain unaffected - but I haven't tested that.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic