调试在 VS 代码中不起作用。将 php 版本从 7.2 升级到 7.4 后

Debugging is not working in VS code. after upgrading php version from 7.2 to 7.4

我已经将我的 PHP 版本从 7.2 升级到 7.4,我发现所有项目都停止了调试。

我的配置是-

zend_extension="/usr/lib/php/20190902/xdebug.so"
xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000

我在下面的文件中添加了上面的配置-

php -v 命令返回以下输出-

PHP 7.4.14 (cli) (built: Jan 13 2021 08:04:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.14, Copyright (c), by Zend Technologies
    with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans

我也在VS code中安装了Xdebug扩展-

php信息();函数返回以下输出-

我应该如何解决我的问题?

PHP 7.4.14 (cli) (built: Jan 13 2021 08:04:06) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.14, Copyright (c), by Zend Technologies
    with Xdebug v3.0.2, Copyright (c) 2002-2021, by Derick Rethans

如果您使用 Xdebug 版本 3,您必须重新配置参数。 (https://xdebug.org/docs/upgrade_guide#Step-Debugging)。根据共享文档,我将建议以下配置:

zend_extension = "/usr/lib/php/20190902/xdebug.so"
xdebug.start_with_request = yes
xdebug.mode = debug
xdebug.client_host = 127.0.0.1
xdebug.log = /tmp/xdebug_remote.log
xdebug.client_port = 9000
xdebug.idekey = VSCODE