Xdebug 3 不会在断点处停止

Xdebug 3 doesn't stop on breakpoints

我设置了 Xdebug 扩展并安装了它,我可以在 phpinfo() 上看到它,但它不会在断点处停止并且不会将任何内容写入 xdebug.log 文件。

这是php.ini内容:

zend_extension = C:\xampp\php\ext\php_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:\xampp\tmp\xdebug\xdebug.log"
xdebug.idekey = VSCODE

这是来自 VSCode 的 launch.json:

{
    // 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"
            }
        }
    ]
}

您没有说明您使用的是三种配置中的哪一种,但是如果您首先使用“Listen for Xdebug”配置,那么 Xdebug 将不会尝试任何操作,因为您有 xdebug.start_with_request = nophp.ini.

将其设置为 trigger 并使用 browser extension, or yes to have Xdebug always initiate the request. Please refer to the documentation 获取更多信息。

日志为空,因为 Xdebug 甚至从未尝试连接到 VS Code 插件。