简体   繁体   English

PhpStorm 无法在 Vagrant 盒子内的 Docker 容器上使用 Xdebug

[英]PhpStorm can't use Xdebug on Docker container inside Vagrant box

I have configured Xdebug inside PHP container which is run by Docker inside Vagrant.我在 PHP 容器中配置了 Xdebug,该容器由 Vagrant 中的 Docker 运行。

What's the best way to get Xdebug working in PhpStorm, so how to expose docker container debugger info (port 9003) to establish connection with PhpStorm on enabled PHP Debug Connections listener.什么是让 Xdebug 在 PhpStorm 中工作的最佳方法,那么如何公开 docker 容器调试器信息(端口 9003)以在启用的 PHP 调试连接侦听器上建立与 PhpStorm 的连接。 Since there are 2 communication layers (PC->Vagrant->Docker)由于有 2 个通信层(PC->Vagrant->Docker)

"to expose docker container debugger info (port 9003) to establish connection with PhpStorm" “公开 docker 容器调试器信息(端口 9003)以建立与 PhpStorm 的连接”

That is the wrong assumption.那是错误的假设。 Xdebug needs to make a connection to your IDE, not the other way around. Xdebug 需要连接您的 IDE,而不是相反。

So you need to tell Xdebug to connect to the IP address that your IDE runs at, which you can possibly find by running "ifconfig" on the host, and there are likely multiple options.因此,您需要告诉 Xdebug 连接到您的 IDE 运行所在的 IP 地址,您可以通过在主机上运行“ifconfig”找到该地址,并且可能有多个选项。

I do not understand why you run Docker in Vagrant though.我不明白你为什么Vagrant 中运行 Docker 。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM