Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

martinszeltins's avatar

php artisan list shows Redis error - "php_network_getaddresses: getaddrinfo failed: No such host is known"

Hi, I am using Docker and I have a container for Redis. But when I run locally php artisan list then I get this error. I want to run this command locally (not in container), I already did composer install locally.

The reason I want to do this on my local machine is so that I could run other artisan commands on my machine (like create a new controller or model). It also helps with intelisense.

$ php artisan list

Predis\Connection\ConnectionException 
php_network_getaddresses: getaddrinfo failed: No such host is known. [tcp://myapp-redis-server:6379]

If I change it to localhost, I get a different error REDIS_HOST=localhost

$ php artisan list

Predis\Connection\ConnectionException 
No connection could be made because the target machine actively refused it. [tcp://localhost:6379]
0 likes
3 replies
bugsysha's avatar

Change bind in /etc/redis/redis.conf file to 0.0.0.0 or what is appropriate for your setup.

martinszeltins's avatar
martinszeltins
OP
Best Answer
Level 14

I guess I didn't need to run it locally after all, I could run them all through a container and it worked docker exec -it app-php-server php artisan list

bugsysha's avatar

When you said running it locally I thought that you were doing it through docker exec 😆

Please or to participate in this conversation.