Search code examples
phpvisual-studio-codexdebug

Listen for Xdebug in VSCode doesn't stop at breakpoint


Although Xdebug with VSCode worked fine for a long time suddenly it's no more possible to debug a PHP script in VSCode.

phpinfo() shows

ZendEngine v4.2.12 with Xdebug v3.3.2.

php.ini:

[xdebug]
zend_extension=xdebug
xdebug.mode=debug,develop
xdebug.start_with_request=yes
xdebug.client_host=127.0.0.1
xdebug.client_port=9003
xdebug.idekey = VSCODE
zend_extension = C:\xampp\php\ext\php_xdebug.dll

VSCode runs the extension php_debug v1.34.0.

launch.json:

  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for Xdebug",
      "type": "php",
      "request": "launch",
      "port": 9003,
    },

and settings.json:

"explorer.confirmDragAndDrop": false,
"workbench.editor.splitInGroupLayout": "vertical",
"php.validate.executablePath": "c:/xampp/php/php.exe",
"php.debug.executablePath": "c:/xampp/php/php.exe",
"editor.tabSize": 2,
"[python]": {

Does anyone have an idea what is wrong?


Solution

  • XDebug is working again. Problem was a hardlink from the original installation-directory to another place. By inserting a pathMapping section in launch.json the error is fixed:

    "configurations": [
      {
        "name": "Listen for Xdebug",
        "type": "php",
        "request": "launch",
        "port": 9003,
        "pathMappings": {
          "c:/xampp/htdocs/xyz": "${workspaceFolder}"
        }
      }
    ]