Debugging Xdebug忽略在Docker容器内创建的Php项目的Netbeans中的断点

Debugging Xdebug忽略在Docker容器内创建的Php项目的Netbeans中的断点,debugging,netbeans,docker,ubuntu-14.04,xdebug,Debugging,Netbeans,Docker,Ubuntu 14.04,Xdebug,当我调试不是在Docker容器中创建的项目时,Xdebug就没有问题了 但当我调试Docker容器内创建的项目时,Xdebug不会在断点处停止——尽管它正在运行,并且在Xdebug_break()上停止 我的Docker主机是Ubuntu 14.04。它作为VirtualBox安装。它将PHP5.5.9-1ubuntu4.16与Xdebug v2.2.3结合使用。我有一个装入的卷(在Docker主机和Docker容器之间),其中存储在Docker容器内创建的项目 Ubuntu 14.0.4中的D

当我调试不是在Docker容器中创建的项目时,Xdebug就没有问题了

但当我调试Docker容器内创建的项目时,Xdebug不会在断点处停止——尽管它正在运行,并且在Xdebug_break()上停止

我的Docker主机是Ubuntu 14.04。它作为VirtualBox安装。它将PHP5.5.9-1ubuntu4.16与Xdebug v2.2.3结合使用。我有一个装入的卷(在Docker主机和Docker容器之间),其中存储在Docker容器内创建的项目

Ubuntu 14.0.4中的Docker容器基于CentOS 6.7版(最终版)。它将PHP5.3.29与Xdebug v2.1.4结合使用,并将Xdebug配置如下(在/etc/PHP.d/Xdebug.ini中):

我已经检查了xdebug.remote_端口设置的所有值,当前显示为注释掉的值。我为xdebug.remote_端口设置尝试了不同的端口(90019002)(当然,在Netbeans中设置了相同的端口)。我还尝试更改xdebug.remote\u connect\u back和xdebug.remote\u autostart设置。我注意到,当这两个参数设置为零时,xdebug实际上挂起并等待连接

但在调试以前部署在Docker容器中的项目时,我仍然无法使Xdebug在断点上停止

我不确定是否遗漏了有关Netbeans设置或Xdebug设置的任何内容。我花了很多时间试图找到解决办法。我试图在xdebug.log中找到一些相关信息,但它似乎没有包含任何对我有意义的内容:

...
<- breakpoint_set -i 1567 -t line -s enabled -f file:///var/www/html/test/index.php -n 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1567" state="enabled" id="11710015"></response>

<- breakpoint_set -i 1568 -t line -s enabled -f file:///home/pkowalski/clients/deployments/demon-prep/application/bootstrap_http.php -n 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1568" state="enabled" id="11710016"></response>

<- run -i 1569
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="1569" status="stopping" reason="ok"></response>

Log closed at 2016-05-20 23:38:11

Log opened at 2016-05-20 23:40:23
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///mnt/deployments/demon-prep/application/bootstrap_http.php" language="PHP" protocol_version="1.0" appid="1172" idekey="netbeans-xdebug"><engine version="2.1.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>

<- feature_set -i 1570 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1570" feature="show_hidden" success="1"></response>
...
。。。
日志于2016-05-20 23:38:11关闭
日志于2016-05-20 23:40:23打开
-> 
...
它似乎成功地设置了断点,但我不确定xdebug.log中的文件路径是否正确。也许我需要在Netbeans内部使用手动路径映射,但我不确定如何做,以及什么路径应该是服务器路径

现在,如果我开始调试,页面将加载。但不久前,浏览器内部出现一个错误,称连接已重置。 除此之外,有几次出现了错误弹出窗口。有一段时间,弹出窗口显示Netbeans和Xdebug之间存在通信问题。其他时间显示不同的消息-存在套接字连接错误。我不知道为什么现在我看不到这些弹出窗口


对于在Docker容器中创建的项目,Xdebug忽略Netbeans中的断点有什么解决方案吗?

最后,我自己解决了这个问题

正如我所料,解决方案是在Netbeans中正确设置路径映射

今天再次分析xdebug.log之后,我注意到日志的开头包含了有趣的信息—init元素的属性fileuri的值:


我的朋友,我的机器也遇到了类似的问题。我的机器已经进行了常规安装,并且安装了docker模块。所以我所做的就是打开
phpxdebug
包,它为我解决了问题

命令:
sudo apt purge php xdebug

...
<- breakpoint_set -i 1567 -t line -s enabled -f file:///var/www/html/test/index.php -n 3
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1567" state="enabled" id="11710015"></response>

<- breakpoint_set -i 1568 -t line -s enabled -f file:///home/pkowalski/clients/deployments/demon-prep/application/bootstrap_http.php -n 7
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="1568" state="enabled" id="11710016"></response>

<- run -i 1569
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="1569" status="stopping" reason="ok"></response>

Log closed at 2016-05-20 23:38:11

Log opened at 2016-05-20 23:40:23
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///mnt/deployments/demon-prep/application/bootstrap_http.php" language="PHP" protocol_version="1.0" appid="1172" idekey="netbeans-xdebug"><engine version="2.1.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>

<- feature_set -i 1570 -n show_hidden -v 1
-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1570" feature="show_hidden" success="1"></response>
...
<init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///mnt/deployments/my-project/application/bootstrap_http.php" language="PHP" protocol_version="1.0" appid="139" idekey="netbeans-xdebug"><engine version="2.1.4"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2012 by Derick Rethans]]></copyright></init>
zend_extension=/usr/lib64/php/modules/xdebug.so 
xdebug.remote_autostart = 0
xdebug.remote_connect_back = 1
xdebug.remote_enable = 1
xdebug.remote_port = 9000
xdebug.remote_handler = dbgp