memcache_connect() [function.memcache-connect]: Can’t connect to localhost:11211

Encountered this error? It could be as simple as switching the host from localhost to


$memcache_obj = memcache_connect('localhost', 11211);


$memcache_obj = memcache_connect('', 11211);

5 thoughts on “memcache_connect() [function.memcache-connect]: Can’t connect to localhost:11211

  1. Kalle

    This occured on Windows right? If so then its because localhost isnt resolved to by PHP if localhost is defined to both an IPv4 and IPv6 alias in the host file 😉

  2. Jason

    Thanks,Kalle..I’ve connected the server by localhost without error..Just modify the the hosts file.

Leave a Reply

Your email address will not be published. Required fields are marked *