Skip to content
Advertisement

Xdebug 3 doesn’t stop on breakpoints

I setted Xdebug extension and it’s installed, I can see it on phpinfo() but it doesn’t stop on the breakpoints and it doesn’t write anything into xdebug.log file.

This is php.ini contents:

zend_extension = C:xamppphpextphp_xdebug-3.0.4-7.4-vc15-x86_64.dll
xdebug.mode = debug
xdebug.start_with_request = no
xdebug.client_port = 9003 
xdebug.client_host = "127.0.0.1"
xdebug.log = "C:xampptmpxdebugxdebug.log"
xdebug.idekey = VSCODE

And this is launch.json from VSCode:

{
    // Use IntelliSense para saber los atributos posibles.
    // Mantenga el puntero para ver las descripciones de los existentes atributos.
    // Para más información, visite: 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"
            }
        }
    ]
}

Advertisement

Answer

You don’t say which of your three configurations you’re using, but if you’re using first the “Listen for Xdebug” one, then Xdebug won’t attempt anything because you have xdebug.start_with_request = no in php.ini.

Set it to either trigger and use a browser extension, or yes to have Xdebug always initiate the request. Please refer to the documentation for more information.

The log is empty, because Xdebug never even attempted to make a connection to the VS Code plugin.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement