Closed basepack closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions and please check out this if you are wondering why we auto close issues.
You saved my day after hours of debugging the same problem with phpunit + multi docker container setup
I added a reference to this specific error in the docs, going to close this out but hopefully the combination of this issue and the docs will help others!
Thank you so much for this post !! It helped me get my docker working!
Thank you so much. This was still a huge help!
Thank you!!!
Saved me a lot of time.
Thank you!!
Thank you!
I don't see any options for a docker image:
This is because by default PHP Storm creates a Local interpreter. Remove this and add a remote interpreter, instead:
You have to choose the correct Docker container:
After that you can follow @basepack their instructions and everything works!
thank you very much!!! helped a lot.
I don't see any options for a docker image:
This is because by default PHP Storm creates a Local interpreter. Remove this and add a remote interpreter, instead:
You have to choose the correct Docker container:
After that you can follow @basepack their instructions and everything works!
try to install and enable Docker and PHP Docker plugin in your PHPStorm IDE.
I had bridge
in Network mode setting which appears in the list but it worked only when I changed it to local_network
which is an actual name of the network in docker file.
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
6cf07ea650a0 bridge bridge local
3824a3e9e38c host host local
1d310e94a7a4 local_network bridge local
acfdd57f7273 none null local
Getting this error while PHPUnit testing in PHPStorm and use a MySQL test database?
Illuminate\Database\QueryException : SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
Well it is already in the docs here, only did I find it after 8 hours of debugging Laravel/Docker/Lando settings. So I thought it should be fair to document it here too, as this was the place I was looking first to see if someone else had experienced this already.
I cannot count the amount of times I ran
lando destroy & lando rebuild -y
anddocker system prune -a --volumes
.But it was a simple thing after all: your docker
appserver
container is somehow separated from yourdatabase
container when running PHPUnit in PHPStorm.To fix it, see here, or follow the convenient screenshots guide from me below:
For this example I use a Lando project that is called
lando-laravel
and therefor the network name is calledlandolaravel_default
for me, yours will be different.Step 1 Run `docker network ls' and get your network name:
Step 2 Go to
PHPStorm Settings > Languages & Frameworks > PHP > Test Frameworks
and click the little folder next toDocker container:
:Step 3 Fill in the networkname you found earlier:
Great! 😁