Vscode-php-debug: XDebug Breakpoints Initially Ignored with Visual Studio Code

Created on 8 Jun 2018  路  4Comments  路  Source: xdebug/vscode-php-debug

PHP version: 7.0.30
XDebug version: 2.6.0
XDebug 2.6.0
VS Code 1.24.04
XAMPP 7.0.30-0

The issue is the Visual Studio Code doesn鈥檛 seem to function correctly with XDebug. Any breakpoints added are ignored.

My launch.json:

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "/opt/lampp/htdocs": "/opt/lampp/htdocs"
            },
            "log": true
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
} 

XDebug php.ini config:

[XDebug]
zend_extension = /opt/lampp/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart = 1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remove_connect_back=0
xdebug.remote_port="9000"
xdebug.profiler_enable=1
xdebug.remote_host="127.0.0.1"
xdebug.max_nesting_level=300
xdebug.remote_log=/opt/lampp/htdocs/tmp/xdebug.log

Adapter logfile (from setting "log": true in launch.json):

<- launchResponse
Response {
  seq: 0,
  type: 'response',
  request_seq: 2,
  command: 'launch',
  success: true }

Most helpful comment

The variable ${workspaceRoot} is deprecated in favor of ${workspaceFolder}. See https://code.visualstudio.com/docs/editor/variables-reference#_why-isnt-workspaceroot-documented

All 4 comments

I'm having the same problem - if I can help by providing any information please let me know.
PHP version: 7.1.14
XDebug version: 2.6.0
VS Code: 1.24.0
PHP Debug: 1.12.3
Docker image: webdevops/php-apache-dev
Local env: Mac OS High Sierra v10.13.4

In addition to the issue with breakpoints, not getting anything showing on debug sidebar (variables, call stack etc), even though details are printing to debug console.
https://d.pr/free/i/j5KNNx

xdebug support | enabled

Directive | Local Value | Master Value
-- | -- | --
xdebug.auto_trace | Off | Off
xdebug.cli_color | 1 | 1
xdebug.collect_assignments | On | On
xdebug.collect_includes | On | On
xdebug.collect_params | 4 | 4
xdebug.collect_return | On | On
xdebug.collect_vars | On | On
xdebug.coverage_enable | On | On
xdebug.default_enable | Off | Off
xdebug.dump.COOKIE | no value | no value
xdebug.dump.ENV | no value | no value
xdebug.dump.FILES | no value | no value
xdebug.dump.GET | * | *
xdebug.dump.POST | no value | no value
xdebug.dump.REQUEST | no value | no value
xdebug.dump.SERVER | REMOTE_ADDR,REQUEST_METHOD | REMOTE_ADDR,REQUEST_METHOD
xdebug.dump.SESSION | no value | no value
xdebug.dump_globals | On | On
xdebug.dump_once | On | On
xdebug.dump_undefined | Off | Off
xdebug.extended_info | On | On
xdebug.file_link_format | vscode://open?url=file://%f&line=%1 | vscode://open?url=file://%f&line=%1
xdebug.filename_format | %f | %f
xdebug.force_display_errors | On | On
xdebug.force_error_reporting | 0 | 0
xdebug.gc_stats_enable | Off | Off
xdebug.gc_stats_output_dir | /tmp | /tmp
xdebug.gc_stats_output_name | gcstats.%p | gcstats.%p
xdebug.halt_level | 0 | 0
xdebug.idekey | VSCODE | VSCODE
xdebug.max_nesting_level | 1000 | 1000
xdebug.max_stack_frames | -1 | -1
xdebug.overload_var_dump | 2 | 2
xdebug.profiler_aggregate | Off | Off
xdebug.profiler_append | Off | Off
xdebug.profiler_enable | On | On
xdebug.profiler_enable_trigger | On | On
xdebug.profiler_enable_trigger_value | no value | no value
xdebug.profiler_output_dir | /tmp/debug | /tmp/debug
xdebug.profiler_output_name | cachegrind.out.%p | cachegrind.out.%p
xdebug.remote_addr_header | no value | no value
xdebug.remote_autostart | On | On
xdebug.remote_connect_back | Off | Off
xdebug.remote_cookie_expire_time | 3600 | 3600
xdebug.remote_enable | On | On
xdebug.remote_handler | dbgp | dbgp
xdebug.remote_host | docker.for.mac.localhost | docker.for.mac.localhost
xdebug.remote_log | /var/log/xdebug.log | /var/log/xdebug.log
xdebug.remote_mode | req | req
xdebug.remote_port | 9080 | 9080
xdebug.remote_timeout | 200 | 200
xdebug.scream | Off | Off
xdebug.show_error_trace | Off | Off
xdebug.show_exception_trace | Off | Off
xdebug.show_local_vars | Off | Off
xdebug.show_mem_delta | Off | Off
xdebug.trace_enable_trigger | Off | Off
xdebug.trace_enable_trigger_value | no value | no value
xdebug.trace_format | 0 | 0
xdebug.trace_options | 0 | 0
xdebug.trace_output_dir | /tmp | /tmp
xdebug.trace_output_name | trace.%c | trace.%c
xdebug.var_display_max_children | 128 | 128
xdebug.var_display_max_data | 512 | 512
xdebug.var_display_max_depth | 3 | 3

AHA! Found a thread that referenced the need to use an absolute path to the local directory in the path mappings rather than using ${workspaceRoot}. Modified and restarted webserver to successful session. Halleleujah. I did look before I posted, I swear ;) Good luck @nunorcsousa - maybe this will help?

The variable ${workspaceRoot} is deprecated in favor of ${workspaceFolder}. See https://code.visualstudio.com/docs/editor/variables-reference#_why-isnt-workspaceroot-documented

Not working for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

andrews05 picture andrews05  路  10Comments

herbertpimentel picture herbertpimentel  路  6Comments

ettoredn picture ettoredn  路  12Comments

PipCodeBoy picture PipCodeBoy  路  5Comments

smuuf picture smuuf  路  10Comments