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

Neh*_*oni 1 php debugging laravel visual-studio-code php-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
Run Code Online (Sandbox Code Playgroud)

我已在以下文件中添加了上述配置 -

  • /etc/php/7.4/apache2/php.ini
  • /etc/php/7.4/apache2/conf.d/20-xdebug.ni
  • /etc/php/7.4/cli/conf.d/20-xdebug.ni
  • /etc/php/7.4/mods-available/xdebug.ini

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
Run Code Online (Sandbox Code Playgroud)

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

在此输入图像描述

phpinfo(); 函数返回以下输出 -

在此输入图像描述

我该怎么做才能解决我的问题?

Thâ*_*ình 5

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
Run Code Online (Sandbox Code Playgroud)

如果使用Xdebugversion 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
Run Code Online (Sandbox Code Playgroud)