You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Xdebug无法在断点处停止的调试问题求助

Xdebug无法在断点处停止

Xdebug无法在断点处停止,我已经尝试了多个版本的Xdebug扩展,包括当前使用的v1.32.1,以及v1.32.0、v1.31.1、v1.31.0、v1.30.0。

VS Code的launch.json配置

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

是否存在与Web服务器的冲突?

php.ini中的Xdebug配置

[xdebug]
zend_extension=C:\xampp\php\ext\php_xdebug.dll
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9003        // 即使去掉这一行也无法正常工作

Xdebug安装向导检测信息

Summary from <https://xdebug.org/wizard> 

    • Xdebug installed: 3.2.1
    • Server API: Apache 2.0 Handler
    • Windows: yes 
    • Compiler: MS VS16
    • Architecture: x64
    • Zend Server: no 
    • PHP Version: 8.2.4
    • Zend API nr: 420220829
    • PHP API nr: 20220829
    • Debug Build: no
    • Thread Safe Build: yes
    • OPcache Loaded: no
    • Configuration File Path: no value
    • Configuration File: C:\xampp\php\php.ini
    • Extensions directory: C:\xampp\php\ext

相关截图

调试界面截图1
调试界面截图2
调试界面截图3
调试界面截图4

已尝试的操作

我已经通过向导下载对应文件并正确重命名,根据文档使用默认端口9003,也尝试过9000,但通过端口检测工具发现9000和9003端口均处于关闭状态。

此外我还执行了以下操作:

  • 重装XAMPP
  • 重装VS Code
  • 开启VS Code中Settings -> Features -> Debug -> Allow Breakpoints Everywhere选项

内容的提问来源于stack exchange,提问作者Nils

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.20 02:15:47