XDebug 在 VScode 中无法用于 php 调试 [英] XDebug not working in VScode for php debugging

查看:19
本文介绍了XDebug 在 VScode 中无法用于 php 调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在所有配置之后,使用 xdebug 和 xampp 在 vscode 中进行 PHP 调试也无法正常工作.

PHP debugging in vscode using xdebug and xampp is not working even after all configurations.

这是我的 php.ini 文件配置:

here is my php.ini file config:

zend_extension = D:\Xampp\php\ext\php_xdebug-3.0.0-7.3-vc15-x86_64.dll
[XDebug]
xdebug.remote_enable = 1
xdebug.remote_autostart = 1

这是json文件

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for XDebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}"
        }

    ]
}

推荐答案

xDebug 3 更改了几个默认值,因此请确保您的代码已准备好使用新的值.

xDebug 3 has changed several default values, so be sure your code is ready to work with new ones.

这是我的配置集,它允许我像往常一样使用 PHP 断点:

Here is my configuration set, which allowed me to use PHP breakpoints as always:

.vscode\launch.json

.vscode\launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Listen for Xdebug",
            "type": "php",
            "request": "launch",
            "port": 9000
        },
        {
            "name": "Launch currently open script",
            "type": "php",
            "request": "launch",
            "program": "${file}",
            "cwd": "${fileDirname}",
            "port": 9000
        }
    ]
}

php.ini(在文件末尾手动插入行)

php.ini (lines manually inserted in the end of a file)

    [xdebug]
    zend_extension = "php_xdebug-3.0.4.dll"
    xdebug.mode = debug
    xdebug.discover_client_host = 1
    xdebug.start_with_request = yes
    xdebug.client_port = 9000

注意:上面的 zend_extension 选项会尝试在 .../modules/php/PHP_%your_php_version%/ext/<中找到您的 xdebug 库/code> 文件夹

Note: above zend_extension option would try to find your xdebug library in a .../modules/php/PHP_%your_php_version%/ext/ folder

这篇关于XDebug 在 VScode 中无法用于 php 调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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