Chris Burgess
Chris Burgess

Reputation: 3631

PhpStorm + Xdebug: Connection established, no Debug window popup in PhpStorm

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:

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.

[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

PhpStorm > Languages > PHP > Debug: PhpStorm > Languages > PHP > Debug

Upvotes: 2

Views: 2164

Answers (2)

LazyOne
LazyOne

Reputation: 165138

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).

Upvotes: 5

MikeSchinkel
MikeSchinkel

Reputation: 5036

Have you tried uncommenting # xdebug.remote_connect_back = on?

We have found that it is always required for working between PhpStorm and XDEBUG. Or maybe better:

xdebug.remote_connect_back=1

We used the above in it our Vagrant solution WPLib Box which we specifically built to make XDEBUG easy with PhpStorm.

I would show it to you in a link but that repo is private. However we recently switched to Docker inside Vagrant and our Docker repo is public os here is our xdebug.ini file for our PHP 7.2.6 Docker container.

Hope this helps solve your issue.

Upvotes: 1

Related Questions