Xdebug忽略断点(浏览器和CLI)

时间:2018-04-21 08:02:44

标签: phpstorm xdebug

到目前为止,我一直在尝试使用nginx(或cli)在PHP 7.2上设置Xdebug。断点被简单地忽略了。尝试使用PhpStorm激活它们并手动使用DefaultRequestHeaders

所有方法至少都会触发Xdebug,因为错误日志说(你可以在下图中看到有问题的代码),但没有任何反应:

xdebug_break()

我的配置是:

Log opened at 2018-04-21 07:50:31
I: Connecting to configured address/port: 127.0.0.1:9000.
I: Connected to client. :-)
-> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" fileuri="file:///Users/riseandcry/Projects/php/jobApplication/index.php" language="PHP" xdebug:language_version="7.2.2" protocol_version="1.0" appid="9859" idekey="PHPSTORM"><engine version="2.6.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[http://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2018 by Derick Rethans]]></copyright></init>

-> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" status="break" reason="ok"><xdebug:message filename="file:///Users/riseandcry/Projects/php/jobApplication/index.php" lineno="4"></xdebug:message></response>

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

Log closed at 2018-04-21 07:50:31

我没有在PHP中加载任何其他扩展,并且PhpStorm验证显示一切正确:

enter image description here

此外,我已经使用各种方法重新安装了所有内容(PHP,nginx,Xdebug),但仍然无效。我的猜测是,它是Xdebug或配置有问题,但不知道是什么。

非常感谢一些帮助。我还在SO和其他论坛上阅读了几乎所有相关的问题,因为我在这里,你可以猜到结果......

1 个答案:

答案 0 :(得分:3)

你在Mac上并且你正在使用nginx ...这意味着很可能你确实安装并运行了 php-fpm 。问题是php-fpm默认也使用TCP 9000端口...所以现在Xdebug连接那里而不是PhpStorm(xdebug日志在这里提供了一个很好的提示,如果你之前已经看过这样的响应)。

不幸的是,PhpStorm无法(无论出于什么原因)检测到Xdebug端口已被Mac上的其他应用程序使用(但在Windows / Linux上运行良好)。

您可以使用此类命令手动验证(查找使用Xdebug端口的条目并查看进程名称):

sudo lsof -nP -iTCP -sTCP:LISTEN

解决方案是将9001和PhpStorm设置中的Xdebug端口更改为php.ini(或任何其他有意义的数字)。

P.S。您需要重启所有调试会话/禁用并启用&#34;手机处理&#34;如果你正在使用它的图标。或者只需重新启动IDE。