Xdebug V3 不会停止 VSCode 中的断点 [英] Xdebug V3 doesn't stop breakpoints in VSCode

查看:34
本文介绍了Xdebug V3 不会停止 VSCode 中的断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 VSCode 在我的 XAMPP 上进行调试,但没有成功.我知道有很多关于这个的问题,我已经尝试了一切,但仍然无法奏效.

I am trying to debug on my XAMPP using VSCode and didn't worked. I know there are tons of questions about this and I've tried everything I can but still won't work.

关于我的 xdebug 扩展,你有一点很奇怪.我目前使用的是 PHP v7.4.12 和 Xdebug 版本 3.

There is really 1 thing weird thou about my xdebug extension.I am currently using PHP v7.4.12 and Xdebug version 3.

我知道我的 Xdebug 可以在 PHP 上运行,因为我查看了 phpinfo() 并且它显示了我如何设置它.奇怪的部分是在许多教程中通常 zend_extension = path..,xdebug.remote_enable = 1xdebug.remote_autostart = 1> 应该够了,但是当我查看 phpinfo 时,如下所示:

I know my Xdebug works on PHP because I viewed phpinfo() and it shows just how I set it. The weird part is among the many of the tutorials out there normally zend_extension = path..,xdebug.remote_enable = 1 and xdebug.remote_autostart = 1 should be enough but when I viewed phpinfo it is as follows below:

我尝试使用 xdebug.remote_port = 9000xdebug.remote_host = "localhost" 设置它,但仍然无法正常工作.我什至读过关于将 localhost 更改为 127.0.0.1 但仍然没有工作.

I tried to set it with xdebug.remote_port = 9000 and xdebug.remote_host = "localhost" but still won't work. I even have read about changing localhost to 127.0.0.1 but still didn't work.

任何帮助将不胜感激.这是我的 launch.json 文件和 php ini 文件.

Any help would be appreciated. Here is my launch.json file and php ini file.

php.ini

zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.remote_enable = 1
xdebug.remote_autostart = 1
xdebug.remote_log = "C:\xampp\tmp\xdebug\xdebug.log"
xdebug.remote_port = 9000
xdebug.remote_host = "127.0.0.1"
xdebug.idekey=VSCODE

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": "Launch current script in console",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "externalConsole": false,
            "port": 9000
        },
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        }
    ]
}

如果是因为没有设置pathMappings"引起的,谁能教教我怎么用?

If it is caused maybe due to not setting "pathMappings", anyone can teach me how to use this?

顺便说一下,xdebug.log 也不起作用

By the way the xdebug.log also doesn't work

推荐答案

您正在使用 Xdebug v3,但继续使用 Xdebug v2 配置参数.您需要阅读从 Xdebug 2 升级到 3 指南并调整您的设置.

You are using Xdebug v3 but keep using Xdebug v2 config parameters. You need to go through Upgrading from Xdebug 2 to 3 Guide and adjust your settings.

Xdebug v3 使用与 Xdebug v2 相比不同的配置参数(您的 phpinfo() 输出会在屏幕截图上准确地告诉您这一点).6 个xdebug"中有 5 个.您当前 php.ini 中的参数在 Xdebug v3 中什么都不做.

Xdebug v3 uses different config params than Xdebug v2 (your phpinfo() output tells you exactly that on your screenshot). 5 out of 6 "xdebug." params from your current php.ini do nothing in Xdebug v3.

对于 Xdebug 3,它应该是这样的(基于您的原始配置):

For Xdebug 3 it should be like this (based on your original config):

zend_extension = "C:\xampp\php\ext\php_xdebug.dll"
xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000
xdebug.client_host = "127.0.0.1"
xdebug.log = "C:\xampp\tmp\xdebug\xdebug.log"
xdebug.idekey = VSCODE

这篇关于Xdebug V3 不会停止 VSCode 中的断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆