phpstorm和docker中的xdebug
我设法将xdebug与docker和phpstorm结合起来。用于http调用…即 但是当我尝试运行我的phpstorm和docker中的xdebug,php,docker,phpstorm,xdebug,Php,Docker,Phpstorm,Xdebug,我设法将xdebug与docker和phpstorm结合起来。用于http调用…即 但是当我尝试运行我的phpunit测试时,它不会连接到phpstorm 我在phpstorm中正确地进行了目录映射,并在docker实例上运行了以下操作export XDEBUG\u CONFIG=“idekey=phpstorm” 我还尝试了我的docker:export PHP_IDE_CONFIG='serverName=web.docker',并将服务器配置命名为phpstorm web.docker。
phpunit
测试时,它不会连接到phpstorm
我在phpstorm中正确地进行了目录映射,并在docker实例上运行了以下操作export XDEBUG\u CONFIG=“idekey=phpstorm”
我还尝试了我的docker:export PHP_IDE_CONFIG='serverName=web.docker',并将服务器配置命名为phpstorm web.docker。仍在http上工作,但不是CLI
那么我可以让phpstorm和xdebug在命令行中一起工作吗
这是我的文件:/etc/php5/cli/conf.d/20xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.idekey=PHPSTORM
xdebug.remote_connect_back=1
xdebug.remote_host=172.17.42.1
dxdebug.remote_autostart=1
当我打开日志记录并使用xdebug\u remote\u主机IP地址时
W: Remote address not found, connecting to configured address/port: localhost:9000. :-|
E: Could not connect to client. :-(
Log closed at 2015-10-13 12:20:39
Log opened at 2015-10-13 12:22:58
I: Checking remote connect back address.
W: Remote address not found, connecting to configured address/port: 172.17.42.1:9000. :-|
E: Could not connect to client. :-(
Log closed at 2015-10-13 12:22:58
Log opened at 2015-10-13 12:23:58
I: Checking remote connect back address.
W: Remote address not found, connecting to configured address/port: 192.168.99.100:9000. :-|
E: Could not connect to client. :-(
Log closed at 2015-10-13 12:23:58
解决方案(编辑)
通过打开xdebug日志记录,我看到它成功地连接到了192.168.99.1
,因此解决了这个问题
xdebug.remote_host=192.168.99.1
我现在想到两件事:
192.168.
地址,对于返回的路径,它是172.17.
地址。你能在那个IP上ping你的主机吗dxdebug.remote_autostart=1
这只是一个输入错误,还是在你的配置文件中?因为它应该读xdebug,前面不带“d”。应该是:
xdebug.remote_autostart=1
只有在执行以下脚本时添加选项时,才应添加d:
php -dxdebug.remote_autostart=1 script.php
xdebug.remote_log = /var/log/xdebug_remote.log
也许这有助于找到问题。对我来说,使用这种配置的ssh隧道是有效的 xdebug.remote\u connect\u back=0 xdebug.remote_host=127.0.0.1
请参阅:自Docker-17.06以来,您可以通过静态主机名:
Docker.for.Mac.localhost
完整答案如下:对于远程调试,IDE使用服务器/主机名作为唯一id来决定要使用的路径映射(
PHP | Servers
)。对于CLI调试,不提供此类信息(无处获取),因此您需要手动提供它(类似于您使用idekey所做的操作)--serverName=ServerNameHere
。另外--我没有100%理解您的提示,但无论如何我尝试了我的docker:export PHP\u IDE\u CONFIG='serverName=web.docker'
,并在phpstorm web.docker上命名了服务器配置。仍在使用http,但不是CLI1)在调试PHPUnit之前,您可以阅读有关远程CLI调试/该服务器名参数的信息2)您的PHP |服务器是什么样子的(请截图)3)。。尝试调试简单的脚本(将它放在项目根目录中;当然是本地和远程的)——至少您可以保证它在调试整体上不起作用,在特定时刻也不起作用。4) xdebug日志对这一失败尝试的描述(确保它是清晰的/只有此请求的详细信息)一些手册--可能有用:(不是docker特有的--只是一般的CLI调试)是的,我遵循了这条准则。我在根公用文件夹中尝试了一个非常简单的echo脚本……同样……在HTTP中工作正常,但在CLI中不工作。下面是我的php storm服务器设置1的屏幕。是的,我可以ping 172.17.42.1
。谢谢Pampy,你关闭日志的提示显示它连接到以下IPxdebug.remote\u host=192.168.99.1
,所以通过设置它,现在一切都好了。我不敢相信,这就是我的问题所在。谢谢尤金