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.
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.
For mac users:
Open terminal and try this command:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With