首页 > 解决方案 > 无法通过网页触发 VS 代码中的 xDebug 插件,并显示错误消息“连接读取 ECONNRESET”

问题描述

我在 Windows 10 上使用 VScode (1.43.1) + xDebug(2.9.3) 来调试我的 PHP (7.4.3 VC15 TS x64) 脚本。我已经按照 Xdebug 说明更新了 php.ini 和 VScode launch.json,并且能够在 cli 模式下调试脚本。

但是,我在 99% 的时间内未能通过网页触发断点,当我从网页启动 php 脚本时,在 VScode 调试控制台中,我收到“连接 x:读取 ECONNRESET”消息并且没有触发断点。但是,有时可能会到达断点。

这是我配置的 launch.json 文件:

enter code here
    {
        // 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": "xDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {
            "name": "CLI",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
        ]
    }


    [xdebug]
    zend_extension = C:\php\ext\php_xdebug-2.9.3-7.4-vc15-x86_64.dll
    xdebug.remote_enable = 1
    xdebug.remote_autostart = 1 
    xdebug.remote_connect_back=1
    xdebug.remote_port = 9000
    xdebug.remote_handler=dbgp

我很感激你对此有所了解。

谢谢,吉米

标签: phpvisual-studio-codexdebug

解决方案


推荐阅读