RedisException php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
Decoding the RedisException: Troubleshooting getaddrinfo failed in Laravel Queues
As a senior developer, I’ve seen countless errors plague the development workflow—from cryptic database connection failures to complex runtime exceptions. One particular error that often trips up developers working with caching and queuing systems like Redis is the network-related issue: RedisException: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution.
If you have successfully installed Redis and the php-redis extension, yet your Laravel queue workers fail with this message, it signals that the problem isn't with the Redis service itself, but rather with how your PHP application is attempting to find the Redis server on the network. This is a classic DNS or network connectivity issue masquerading as a Redis error.
Here is a comprehensive breakdown of why this happens and the systematic steps you need to take to resolve it.
Understanding the Root Cause: What Does getaddrinfo failed Mean?
The function getaddrinfo() is responsible for resolving a hostname (like redis.myserver.com) into a usable IP address. When this fails with "Temporary failure in name resolution," it means your PHP process cannot successfully communicate with the Domain Name System (DNS) servers to translate the hostname into an IP address.
In simple terms: Your application knows what Redis you want to talk to, but it cannot find the physical address of that server.
This typically points to one of three areas: DNS configuration, network routing, or firewall interference.
Step-by-Step Troubleshooting Guide
To fix this error, we need to isolate whether the issue lies on the application server, the Redis server, or the network path between them. Follow these steps methodically:
1. Verify Basic Network Connectivity (The Ping Test)
First, confirm that the machine running your Laravel application can even see the Redis host. Use command-line tools to test basic connectivity:
# Replace redis.host with your actual Redis hostname or IP
ping redis.host
nslookup redis.host
If ping fails or nslookup returns errors, you have confirmed a fundamental network issue that needs resolving outside of PHP.
2. Check DNS Configuration on the Application Server
If basic ping tests work but application code still fails, the issue is likely with the DNS settings on the machine running PHP-FPM or your web server.
- Check
/etc/resolv.conf(Linux): Ensure that the nameservers listed here are valid and reachable. Temporary failures often mean the configured DNS servers are temporarily unavailable or misconfigured. - Test External DNS: Try manually querying a public DNS server from the command line to see if general name resolution is working:
dig google.com. If this also fails, the entire machine's network access to the internet might be compromised.
3. Examine Firewalls and Port Access
Even if the hostname resolves correctly, a firewall sitting between your application server and the Redis server can block the necessary outbound DNS queries (port 53) or the actual Redis communication port (default 6379). Check both the application server's local firewall and any network security groups.
4. Review Laravel Configuration
While this error is usually external, it’s worth ensuring your configuration is robust. When setting up queue connections in Laravel, ensure you are using the correct connection details. For example, in your .env file:
QUEUE_CONNECTION=redis
REDIS_HOST=your_redis_server_ip # Ensure this is accurate
REDIS_PORT=6379
If you are using a containerized environment (like Docker), ensure that the network bridge correctly exposes the Redis service to the application service. This setup is crucial when scaling services, especially when architecting robust applications, as detailed in best practices for modern Laravel deployments on platforms like laravelcompany.com.
Conclusion
The php_network_getaddresses: getaddrinfo failed error is a strong indicator of a network layer breakdown rather than a bug within the Redis driver itself. By systematically checking DNS resolution, firewall rules, and basic connectivity using tools outside of PHP, you can isolate the problem quickly. Focus on the infrastructure first; once your application server can reliably resolve hostnames, your Laravel queues will connect successfully.