首页 > 解决方案 > 调试卡在 PhpStorm

问题描述

调试在我的任何 PhpStorm 项目上都不再起作用,当我开始监听传入连接时,脚本被阻塞,直到我停止监听连接,即使我的代码上没有断点。当我在第一行设置断点时(它不适用于其他行),脚本确实停止了,但是当我告诉他转到下一行时,它再次阻塞(即使使用最简单的代码)。

我尝试检查调试配置一切正常(我使用了 PhpStorm 的验证器),路径映射也正常,上周一切正常,我什么也没做......

这是我在 php.ini 上的配置:

xdebug.remote_autostart=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.remote_log=[path]/xdebug.log
xdebug.idekey=PHPSTORM

这是我的 xdebug.log 的一部分,当我在第一行放一个断点然后跨步时:

[4605] Log opened at 2019-03-12 14:13:50
[4605] I: Connecting to configured address/port: 127.0.0.1:9000.
[4605] I: Connected to client. :-)
[...]
[4605] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="context_get" transaction_id="19" context="1"><property name="$_COOKIE" fullname="$_COOKIE" type="array" [...] </property></response>
[...]
[4605] <- step_over -i 21
[4605] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_over" transaction_id="21" status="break" reason="ok"><xdebug:message filename="file:///[path]" lineno="4"></xdebug:message></response>
[4605]

第一个响应是当它在第一行的断点处停止时,我在变量“$_COOKIE”记录的情况下一切正常,然后我跳过了一步,脚本就像卡住了。问题不可能出在代码中,我尝试了一个只有 2 个“回声”的脚本。我尝试重新启动 apache,尝试重新启动 PhpStorm,并尝试重新启动计算机,但没有任何改变。

我的 PhpStorm 版本:

PhpStorm 2018.1
Build #PS-181.4203.565, built on March 28, 2018
JRE: 1.8.0_152-release-1136-b20 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.4.0-102-generic

我的 php 版本:

PHP 7.1.27-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Mar  7 2019 20:02:03) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.1.27-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v2.7.0, Copyright (c) 2002-2019, by Derick Rethans

你知道什么是 hapening 吗?(看来我的php版本是上周构建的,也许是链接的......)

标签: phpphpstormxdebug

解决方案


我找到了答案,它是 phpstorm 2018.1 和 Xdebug 2.7.0 之间的不兼容,因为它在这个 xdebug 错误报告中被告知:https ://bugs.xdebug.org/view.php?id=1637

我将phpstorm升级到2018.3版本,现在一切正常。


推荐阅读