XDEBUG不会在断点处停止.

我try 了不同版本的XDEBUG.(当前v1.32.1、v1.32.0、v1.31.1、v1.31.0、v1.30.0)

这是我在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]
zend_extension=C:\xampp\php\ext\php_xdebug.dll
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9003        // it also doesnt work without this line.

安装向导

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

enter image description here

enter image description here

enter image description here

enter image description here

我已从向导下载了该文件,并已正确重命名.

根据说明文件,端口9003是正确的.但我也try 过9000端口.

如果我转到https://portchecker.co/checking并判断端口9000或9003,它们已关闭.

  • 我重新安装了XAMPP
  • 我重新安装了VS代码

我也到了Settings -> Features -> Debug -> Allow Breakpoints Everywhere岁.

推荐答案

我继续安装了xampp和xdebug.

我们的启动.json文件和向导输出是相同的,它似乎对我来说工作得很好.

我的php.ini不包括带有端口号的最后一行,也不包括xdebug结束括号后面的撇号.

[xDebug]
zend_extension = xdebug
xdebug.mode = debug
xdebug.start_with_request = yes

考虑到已经为您映射了扩展名目录,您应该不需要Zend_扩展名的整个文件路径.

我会再次判断您是否也在vscode设置中定义了您的"php.debug.executablePath":.

这是我的照片之后的样子

  1. 在vscode中运行Listen for Xdebug
  2. 在浏览器中导航到我在http://localhost/info/index.php中使用的文件

Xdebug Running

如果进行这些更改仍然不起作用,也许可以仔细判断断点是否确实可访问.

Php相关问答推荐

从WooCommerce邮箱通知中的订单详细信息中删除产品列表

FatFreeFramework上的不同路由

Laravel:让所有用户在一年中的特定月份休息几天

PHP中冒号的奇怪用例

在WooCommerce中禁用客户用户角色的纳税计算

在Laravel Eloquent中实现一对多关系

免费送货柜台,考虑到折扣码

curl_close()未从PHP 8开始写入CURLOPT_COOKIEJAR会话文件

为WooCommerce中存储一些数据的购物车项目添加复选框

关于Laravel缓存出现的错误

多个产品类别 Select 自定义 WooCommerce 插件设置页面

将产品数量、名称和结帐链接添加到 WooCommerce 添加到购物车消息

循环中未序列化数组显示的问题

后退按钮不起作用 laravel ajax crud

$_SERVER 超全局变量在 PHP 中是否保证可写?

在 Symfony 测试中何时使用 TestCase 而不是 KernelTestCase

如何使用在产品快速编辑菜单前端的自定义框中 Select 的值更新 woocommerce 产品属性值?

我怎样才能在 .htaccess 中有 2 个参数?

laravel 中的 OrderBy json 列

获取具有所有特定相关模型的模型