PhpStorm + Xdebug:建立连接,PhpStorm中没有调试窗口弹出 [英] PhpStorm + Xdebug: Connection established, no Debug window popup in PhpStorm

查看:76
本文介绍了PhpStorm + Xdebug:建立连接,PhpStorm中没有调试窗口弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力让PhpStorm和Xdebug在特定的Vagrant VM上正常播放.

如何为该虚拟机有效地跟踪并解决连接PhpStorm和Xdebug的问题?

虽然我可以看到PhpStorm和Xdebug在某种程度上进行通信,但是Xdebug的连接无法启动PhpStorm的调试窗口,并且无法使用PhpStorm的调试功能.

有问题的工具组合为:

  • 具有Ubuntu 16-04的游民VM
  • 带有php-xdebug 2.7的PHP 7.1
  • PhpStorm 2018.2.1
  • Firefox Xdebug Helper扩展
  • Drupal 8.6.10
  • 在第16行的index.php中插入了断点.

我能够使这个Vagrant VM连接到Atom的php-debug Xdebug集成.我还可以使PhpStorm连接到其他Vagrant实例的Xdebug!

有关服务器的Xdebug配置:

# xdebug.idekey = "PHPSTORM"
# xdebug.remote_connect_back = on
xdebug.remote_autostart = off
# xdebug.remote_connect_back = on
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.remote_host = 10.0.2.2 # IP of the host system
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_mode=req
xdebug.remote_port=9000

使用此配置时,我在日志文件/tmp/xdebug.log中看到输出.

  • 将Xdebug Helper设置为禁用"后,页面将在浏览器中加载.没有日志条目记录到/tmp/xdebug.log.
  • 将PhpStorm设置为停止侦听PHP调试连接"后,页面将加载到浏览器中.没有日志条目记录到/tmp/xdebug.log.
  • 将Xdebug Helper设置为"Debug",将PhpStorm设置为开始侦听PHP调试连接"后,页面将暂停,就好像可以识别断点一样.但是,PhpStorm不会打开调试窗口,因此无法进行调试.以下记录到/tmp/xdebug.log:

[8264] Log opened at 2019-03-14 01:39:02
[8264] I: Connecting to configured address/port: 10.0.2.2:9000.
[8264] I: Connected to client. :-)
[8264] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/drupal/web/index.php" language="PHP" xdebug:language_version="7.1.26-1+ubuntu16.04.1+deb.sury.org+1" protocol_version="1.0" appid="8264" idekey="PHPSTORM"><engine version="2.7.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]></copyright></init>
[8264]
[8264] <- feature_set -i 1 -n show_hidden -v 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>
[8264]
[8264] <- feature_set -i 2 -n max_depth -v 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>
[8264]
[8264] <- feature_set -i 3 -n max_children -v 100
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>
[8264]
[8264] <- feature_set -i 4 -n extended_properties -v 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response>
[8264]
[8264] <- feature_set -i 5 -n notify_ok -v 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response>
[8264]
[8264] <- stdout -i 6 -c 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="6" success="1"></response>
[8264]
[8264] <- status -i 7
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="status" transaction_id="7" status="starting" reason="ok"></response>
[8264]
[8264] <- step_into -i 8
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file:///var/www/html/drupal/web/index.php" lineno="14"></xdebug:message></response>
[8264]
[8264] <- eval -i 9 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="9"><property type="bool"><![CDATA[0]]></property></response>
[8264]
[8264] <- eval -i 10 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="10"><property type="bool"><![CDATA[1]]></property></response>
[8264]
[8264] <- eval -i 11 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="string" size="9" encoding="base64"><![CDATA[bG9jYWxob3N0]]></property></response>
[8264]
[8264] <- eval -i 12 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="string" size="4" encoding="base64"><![CDATA[ODAwMA==]]></property></response>
[8264]
[8264] <- eval -i 13 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="string" size="1" encoding="base64"><![CDATA[Lw==]]></property></response>
[8264]

如果我然后单击停止侦听PHP调试连接",则会立即看到以下内容记录到/tmp/xdebug.log:

[8264] <- run -i 14

然后紧随其后的是此记录的输出(此问题太大),然后页面和资源按照以前的方式加载.

如何为该虚拟机有效地跟踪和解决连接PhpStorm和Xdebug的问题?

PhpStorm>语言> PHP:

PhpStorm>语言> PHP>调试:

解决方案

您正在将PhpStorm 2018.2.x与Xdebug 2.7结合使用.

将PhpStorm升级到最新的稳定版2018.3.x或将Xdebug降级到2.6.x

问题出在Xdebug 2.7(https而不是http)以及Xdebug协议中最近更改的XML名称空间中.自PhpStorm 2018.3.0起已修复/受支持(请参见 WI-43622 ).

I'm struggling to get PhpStorm and Xdebug to play nicely on a specific Vagrant VM.

How can I effectively track down and resolve the issue in connecting PhpStorm and Xdebug for this VM?

While I can see that PhpStorm and Xdebug are communicating to a degree, the connection from Xdebug does not launch PhpStorm's debug window, and it's not possible to use PhpStorm's debugging capabilities.

The combination of tools in question is:

  • Vagrant VM with Ubuntu 16-04
  • PHP 7.1 with php-xdebug 2.7
  • PhpStorm 2018.2.1
  • Firefox Xdebug Helper extension
  • Drupal 8.6.10
  • Breakpoint is inserted in index.php at line 16.

I'm able to get this Vagrant VM to connect to Atom's php-debug Xdebug integration. I'm also able to get this PhpStorm to connect to other Vagrant instance's Xdebug!

Xdebug config from the server in question:

# xdebug.idekey = "PHPSTORM"
# xdebug.remote_connect_back = on
xdebug.remote_autostart = off
# xdebug.remote_connect_back = on
xdebug.remote_enable = on
xdebug.remote_handler=dbgp
xdebug.remote_host = 10.0.2.2 # IP of the host system
xdebug.remote_log="/tmp/xdebug.log"
xdebug.remote_mode=req
xdebug.remote_port=9000

I see output in the logfile /tmp/xdebug.log when using this configuration.

  • With Xdebug Helper to "Disable", the page loads in the browser. No log entries are recorded to /tmp/xdebug.log.
  • With PhpStorm set to "Stop listening for PHP Debug connections", the page loads in the browser. No log entries are recorded to /tmp/xdebug.log.
  • With Xdebug Helper set to "Debug" and PhpStorm set to "Start listening for PHP debug connections", the page is paused as though the breakpoint is recognised. However, PhpStorm does not bring up a debug window, so it's not possible to debug. The following is logged to /tmp/xdebug.log:

[8264] Log opened at 2019-03-14 01:39:02
[8264] I: Connecting to configured address/port: 10.0.2.2:9000.
[8264] I: Connected to client. :-)
[8264] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///var/www/html/drupal/web/index.php" language="PHP" xdebug:language_version="7.1.26-1+ubuntu16.04.1+deb.sury.org+1" protocol_version="1.0" appid="8264" idekey="PHPSTORM"><engine version="2.7.0"><![CDATA[Xdebug]]></engine><author><![CDATA[Derick Rethans]]></author><url><![CDATA[https://xdebug.org]]></url><copyright><![CDATA[Copyright (c) 2002-2019 by Derick Rethans]]></copyright></init>
[8264]
[8264] <- feature_set -i 1 -n show_hidden -v 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="1" feature="show_hidden" success="1"></response>
[8264]
[8264] <- feature_set -i 2 -n max_depth -v 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="2" feature="max_depth" success="1"></response>
[8264]
[8264] <- feature_set -i 3 -n max_children -v 100
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="3" feature="max_children" success="1"></response>
[8264]
[8264] <- feature_set -i 4 -n extended_properties -v 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="4" feature="extended_properties" success="1"></response>
[8264]
[8264] <- feature_set -i 5 -n notify_ok -v 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="feature_set" transaction_id="5" feature="notify_ok" success="1"></response>
[8264]
[8264] <- stdout -i 6 -c 1
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stdout" transaction_id="6" success="1"></response>
[8264]
[8264] <- status -i 7
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="status" transaction_id="7" status="starting" reason="ok"></response>
[8264]
[8264] <- step_into -i 8
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="8" status="break" reason="ok"><xdebug:message filename="file:///var/www/html/drupal/web/index.php" lineno="14"></xdebug:message></response>
[8264]
[8264] <- eval -i 9 -- aXNzZXQoJF9TRVJWRVJbJ1BIUF9JREVfQ09ORklHJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="9"><property type="bool"><![CDATA[0]]></property></response>
[8264]
[8264] <- eval -i 10 -- aXNzZXQoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="10"><property type="bool"><![CDATA[1]]></property></response>
[8264]
[8264] <- eval -i 11 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9OQU1FJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="11"><property type="string" size="9" encoding="base64"><![CDATA[bG9jYWxob3N0]]></property></response>
[8264]
[8264] <- eval -i 12 -- KHN0cmluZykoJF9TRVJWRVJbJ1NFUlZFUl9QT1JUJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="12"><property type="string" size="4" encoding="base64"><![CDATA[ODAwMA==]]></property></response>
[8264]
[8264] <- eval -i 13 -- KHN0cmluZykoJF9TRVJWRVJbJ1JFUVVFU1RfVVJJJ10p
[8264] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="eval" transaction_id="13"><property type="string" size="1" encoding="base64"><![CDATA[Lw==]]></property></response>
[8264]

If I then click "Stop listening for PHP debug connections", I immediately see the following logged to /tmp/xdebug.log:

[8264] <- run -i 14

Then that's quickly followed by this logged output (too large for this question), and the page and resources load as per before.

How can I effectively track down and resolve the issue in connecting PhpStorm and Xdebug for this VM?

PhpStorm > Languages > PHP:

PhpStorm > Languages > PHP > Debug:

解决方案

You are using PhpStorm 2018.2.x with Xdebug 2.7.

Either upgrade PhpStorm to the latest stable 2018.3.x or downgrade Xdebug to 2.6.x

The problem is in recently changed XML namespace in Xdebug protocol, as of Xdebug 2.7 (https instead of http). It's fixed/supported since PhpStorm 2018.3.0 (see WI-43622).

这篇关于PhpStorm + Xdebug:建立连接,PhpStorm中没有调试窗口弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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