Reputation: 89
When I use redis PHP extension, I get the error, the host is 127.0.0.1 and the port is 6379.
Redis::connect(): php_network_getaddresses: getaddrinfo failed: Name or service not known.
Upvotes: 7
Views: 40615
Reputation: 733
For mac users:
Open terminal and try this command:
Upvotes: 8
Reputation: 5918
In my case, the issue was simple; the host name was incorrectly typed.
To find out the exact issue, I had to do the following in my console:
ping <host-name>
or if you have redis-cli installed, you can just call that from the console as such:
redis-cli -h <host-name> -p <port-number> -a <auth-pass>
Upvotes: 0
Reputation: 955
I had the same issue happening sporadically on my local server with a number of attempted fixes yielding no resolution. This post here gave me an idea that seems to have finally fixed the problem.
Basically, I have a number of vhosts set up on my local machine (running Ubuntu) which allows me to use domain names to access locally-run sites instead of the usual 'localhost/sitename' approach. As a result, I had no IP assigned to 'localhost' name.
This might not be the same root cause for the problem for you, but here's how I've solved mine:
Of course, as a sanity check, make sure your redis-server is up and running, try rebooting Apache in case you've made any config changes, etc.
Upvotes: 6