Viewing 5 replies - 1 through 5 (of 5 total)
  • I would also like to know.

    I add line in wp-config.php
    $memcached_servers = array(
    ‘default’ => array(
    ‘unix:/xxxx/xxx/memcached.socket’
    )
    );

    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”

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

    $memcached_servers = array(
      'default' => array(
        'unix:///tmp/memcached.socket'
      )
    );

    Works for me. Think the tripple slash is the secret sauce ??

    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(
        'unix:///tmp/memcached.socket:0
      )
    );

    But I didn’t get it to work either ??

    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; }
    else
    { $port = $node;
    $node = $host; }

    fixes it for socket connections to Memcache.

    TCP connections to Memcache should remain unaffected – but I haven’t tested that.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Memcached with Unix socket’ is closed to new replies.