0

我设置了 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

这是launch.json来自 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"
            }
        }
    ]
}
4

1 回答 1

1

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

将其设置为或者trigger使用浏览器扩展,或者yes让 Xdebug 始终发起请求。请参阅文档以获取更多信息。

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

于 2021-09-19T18:45:46.463 回答