xdebug connects but won't break in WordPress with vvv

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]]/engineauthor![CDATA[Derick Rethans]]/authorurl![CDATA[https://xdebug.org]]/urlcopyright![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.)

Topic vagrant debug Wordpress

Category Web


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.

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.