Oskar Persson
Oskar Persson

Reputation: 6765

Memcache and memcached: "getaddrinfo failed"

I have installed memcache and memcached in XAMPP in OSX Mountain Lion. Though non of them appear in phpinfo().

At the top of my index.php file I simply include the file:

include 'memcache.php'

Then when I enter my website I get a MEMCACHE INFO page that gives me this error:

Error message: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known`

What am I doing wrong?

Can memcache and memcached be installed without showing up in phpinfo()?

Upvotes: 2

Views: 5182

Answers (3)

Oskar Persson
Oskar Persson

Reputation: 6765

Fixed it my following this guide. Seems like memcache wasn't completely installed or something because now it appears in phpinfo() and everything is working! Don't know why it wasn't working when following several other tutorials though a theory is that it installed memcache for the built-in apache in OSX.

Upvotes: 0

Ray
Ray

Reputation: 41448

There has to be a memcache or memcached daemon running and listening on. Memcache(d) is just like a separate server process like apache. It listens at a port / socket for requests. If you don't have one running, you can't connect to it. If one is running, you probably got the connection details wrong... It's sort of like your DSN string for access to a database through mysqli or PDO.

I'm guessing inside the 'memcache.php' file your including, it's asking to set a hostname or nodename. This also tells me you should be trying to connect to a memcached server (as memcached has the concept of nodes). Open it up and find where it's trying to connect to the memcache server and edit it to point to localhost or whatever your machine name is (or ip address).

Upvotes: 1

Brad
Brad

Reputation: 163438

The issue is that the hostname you have provided for connecting to memcached is incorrect. Your error is essentially that DNS cannot find the hostname.

Upvotes: 1

Related Questions