Xdebug与PHPStorm和Docker容器 [英] Xdebug with PHPStorm and a Docker container

查看:585
本文介绍了Xdebug与PHPStorm和Docker容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

设置:Windows 10; Docker在Hyper-V上使用Boot2Docker运行; PHPStorm 9



VM上的Webserver是Nginx。我已将php5-fpm的xdebug.ini配置为:

  zend_extension = xdebug.so 
xdebug.remote_enable = on
xdebug.remote_port = 9000
xdebug.remote_connect_back = On
xdebug.remote_handler = dbgp
xdebug.profiler_enable = 0
/ pre>

如果我设置了一个断点并重新加载页面,我将收到来自PHPStorm中的Xdebug的传入连接:





我想知道只显示一个文件,而不是整个项目大得多。如果我接受连接,我可以调试第一行,但是它不是在我的断点上停止,并创建一个服务器条目,如下所示:




主机是空的很奇怪。
我已经使用正确的映射添加了服务器,但被忽略。



那么如何让Xdebug停止断点?

解决方案


主机是空的很奇怪。


PhpStorm需要填充这个字段,因为它使用这个以识别要使用的服务器条目(因此路径映射) - IDE支持调试在不同域/远程服务器上运行的相同代码库。



在这种特殊情况下您的nginx配置的字段/参数为空, servername 您可以通过在nginx配置文件中提供一些值来解决此问题。


Setup: Windows 10; Docker running with Boot2Docker on Hyper-V; PHPStorm 9

Webserver on the VM is Nginx. I've configured the xdebug.ini for php5-fpm as:

zend_extension=xdebug.so
xdebug.remote_enable=on
xdebug.remote_port=9000
xdebug.remote_connect_back=On
xdebug.remote_handler=dbgp
xdebug.profiler_enable=0

If I set a breakpoint and reload the page I get an incoming connection from Xdebug in PHPStorm:

I wonder that there is only one file shown and not the entire project which is much bigger. If I accept the connection I can debug the very first line but it is not stopping on my breakpoint and creates a server entry which looks like:

What is very strange that host is empty. I already added the server with the correct mapping but it got ignored.

So how to get Xdebug to stop on breakpoints?

解决方案

What is very strange that host is empty.

PhpStorm requires this field to be filled as it uses this to recognize what server entry (and therefore path mappings) to use -- IDE supports debugging the same code base running on different domains / remote servers.

In this particular case the servername field / parameter of your nginx configuration is empty. You can fix this by providing some value in nginx config file.

这篇关于Xdebug与PHPStorm和Docker容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆