Xdebug is successfully installed on Windows but not working

Issue

  1. I downloaded the dll file by copy-pasting the phpinfo() output to Xdebug site, so I think I got the right file.
  2. I edited my php.ini file and restarted Apache web server (I’m using XAMPP).
  3. I set breakpoints, hit "Add Configuration" and Run the debug in Visual Studio Code.

Unfortunately, the breakpoint did not worked.
I have gone through many topics, tutorials but it still not works.

This is how my php.ini file looks like:

[XDebug]
zend_extension = "D:\xampp\php\ext\php_xdebug-3.0.4-8.0-vs16-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

This is my config file:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Listen for Xdebug",
      "type": "php",
      "request": "launch",
      "port": 9003
    },
    {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 0,
      "runtimeArgs": [
        "-dxdebug.start_with_request=yes"
      ],
      "env": {
        "XDEBUG_MODE": "debug,develop",
        "XDEBUG_CONFIG": "client_port=${port}"
      }
    },
    {
      "name": "Launch Built-in web server",
      "type": "php",
      "request": "launch",
      "runtimeArgs": [
        "-dxdebug.mode=debug",
        "-dxdebug.start_with_request=yes",
        "-S",
        "localhost:0"
      ],
      "program": "",
      "cwd": "${workspaceRoot}",
      "port": 9003,
      "serverReadyAction": {
        "pattern": "Development Server \\(http://localhost:([0-9]+)\\) started",
        "uriFormat": "http://localhost:%s",
        "action": "openExternally"
      }
    }
  ]
}

This is the image I took using the xdebug_info();

enter image description here

Your help save my day.

Solution

Your screenshot shows that you don’t have the Step Debugger enabled (it says "Disabled").

Your config says:

zend_extension = "D:\xampp\php\ext\php_xdebug-3.0.4-8.0-vs16-x86_64.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

Xdebug 3 does no longer use xdebug.remote_enable or xdebug.remote_autostart. As per the Upgrade Guide these have been renamed to:

xdebug.mode=debug
xdebug.start_with_request=yes

The "Docs" column in your screenshot also links to the documentation for that specific feature.

Answered By – Derick

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published