1

I am using vvv for local WordPress development and cannot get xdebug to pause on breakpoints.

  • I have ssh'ed in and set the xdebug_on command.
  • phpinfo() shows xdebug installed and active
  • phpinfo() shows remote_autostart and remote_enable both set
  • my xdebug client (VS Code) is configured to listen on the same port as xdebug is configured to broadcast.

When I add a breakpoint (for instance, on the first line of substance in WordPress's index.php) and tell my client to listen, then load the page in my browser, I expect xdebug to pause on that line. This expectation is based on previous usage of xdebug.

This doesn't happen, but xdebug and my client seem to connect. That's the part I don't get.

Here is the xdebug log:

[3918] Log opened at 2019-03-09 20:08:19
[3918] I: Connecting to configured address/port: 192.168.50.1:9000.
[3918] I: Connected to client. :-)
[3918] -> <init xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" fileuri="file:///srv/www/wordpress-one/public_html/index.php" language="PHP" xdebug:language_version="7.2.15-1+ubuntu14.04.1+deb.sury.org+1" protocol_version="1.0" appid="3918" idekey="VVVDEBUG"><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>
[3918]
[3918] <- breakpoint_list -i 1
[3918] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="1"></response>
[3918]
[3918] <- breakpoint_set -i 2 -t line -f file:///e:/work/vvv/VVV/wordpress-one/public_html/index.php -n 14
[3918] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2" id="39180029"></response>
[3918]
[3918] <- breakpoint_list -i 3
[3918] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="3"><breakpoint type="line" filename="file:///e:/work/vvv/VVV/wordpress-one/public_html/index.php" lineno="14" state="enabled" hit_count="0" hit_value="0" id="39180029"></breakpoint></response>
[3918]
[3918] <- breakpoint_list -i 4
[3918] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="breakpoint_list" transaction_id="4"><breakpoint type="line" filename="file:///e:/work/vvv/VVV/wordpress-one/public_html/index.php" lineno="14" state="enabled" hit_count="0" hit_value="0" id="39180029"></breakpoint></response>
[3918]
[3918] <- run -i 5
[3918] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="run" transaction_id="5" status="stopping" reason="ok"></response>
[3918]
[3918] <- stop -i 6
[3918] -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="https://xdebug.org/dbgp/xdebug" command="stop" transaction_id="6" status="stopped" reason="ok"></response>
[3918]
[3918] Log closed at 2019-03-09 20:08:19

It shows xdebug understanding my breakpoint, connecting to the client, and registering my browser's load of the page.

(Granted this may be more of an xdebug thing, but it is all based on the vvv setup which is all about WordPress.)

  • What version of PHP and Xdebug are in use? Just curious, because I noticed that Xdebug just recently became compatible with PHP 7.3. – Dave Romsey Mar 9 '19 at 21:43
  • 1
    PHP 7.2.16, , xdebug 2.7.0. Also I had read of some others (not vvv) who were having port issues with the default 9000, but I (a) can't figure out how to edit php.ini with vvv, and (b) it is connecting anyways, as shown in the log – tmdesigned Mar 9 '19 at 21:46
1

In my case it turned out to be a path mapping issue. Adding...

"pathMappings" : {
    "/srv/www" : "C:\\Users\\tmorgan\\websites\\local\\www"
}

...fixed it for me. In other words, explicitly specifying how the server path related to my local file path was necessary. I did not think this was the case because xdebug was connecting to my client, but connecting is different from successful file mapping.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.