Xdebug 3 - 设置 'xdebug.remote_***' 已重命名,请参阅升级指南

Xdebug 3 - The setting 'xdebug.remote_***' has been renamed, see the upgrading guide

我刚刚在 OSX 上安装了 Xdebug v3.0.0beta1 并尝试在 PhpStorm 2020.1 上使用它,但我得到了这个 :

Xdebug: [Config] The setting 'xdebug.remote_enable' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_enable (See: https://xdebug.org/docs/errors#CFG-C-CHANGED) Xdebug: [Config] The setting 'xdebug.remote_host' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_host (See: https://xdebug.org/docs/errors#CFG-C-CHANGED) Xdebug: [Config] The setting 'xdebug.remote_mode' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_mode (See: https://xdebug.org/docs/errors#CFG-C-CHANGED) Xdebug: [Config] The setting 'xdebug.remote_port' has been renamed, see the upgrading guide at https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_port

所提供的链接只会导致一张有错误的图像。

我的问题是设置的正确设置是什么以及实际更改它们的位置,因为我的 php.ini 文件中没有关于 xdebug 的信息。

Xdebug 3 仅从 PhpStorm 2020.3 版本开始支持,目前处于 EAP 阶段(抢先体验计划),大约 1 个月后发布。

目前,您必须为 2020.1 IDE 版本坚持使用 Xdebug 2.9,或者尝试最新的 2020.3 EAP 版本:https://www.jetbrains.com/phpstorm/nextversion/

最新的 EAP #6 版本支持 Xdebug 3:https://blog.jetbrains.com/phpstorm/2020/11/phpstorm-2020-3-eap-6/


至于 Xdebug 3 升级,在更改 Xdebug 设置方面 (php.ini) -- 检查此 link:https://xdebug.org/docs/upgrade_guide


如果愿意,您可以将 2020.1 PhpStorm 与 Xdebug 3 一起使用——只需正确配置 Xdebug 3。

我在 Xdebug 3.0.0beta1 上工作正常,PHP 7.4 x64 on Windows 10 -- 看这个问题:

您看到的这些错误表明您的 php.ini 中仍有 Xdebug 2 配置值。

在我的例子中,我有 PHP Storm 2020.2 并且在 IDE 方面没有任何改变,但是,在服务器端我必须改变一些东西

为了启用 Xdebug 3,您需要设置 xdebug.mode = debug 进行单步调试

在我的特定服务器配置中,我是这样设置的:

  • /etc/php/7.3/cgi/conf.d/20-xdebug.ini

zend_extension=xdebug.so

  • /etc/php/7.3/cgi/conf.d/21-xdebug-mgs.ini

xdebug.mode = debug

然后在我网站根目录的 .user.ini 中我设置了这个:

[xdebug]
xdebug.client_host = "10.0.0.2"
xdebug.client_port = 9001
xdebug.remote_connect_back = false
xdebug.log = '/var/www/clients/client1/web2/web/j39vm36/administrator/logs/xdebug.log'
xdebug.profiler_output_name = cachegrind.out.%t.%p
xdebug.output_dir = '/var/www/clients/client1/web2/web/j39vm36/administrator/logs/'
xdebug.var_display_max_depth = -1
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1

我的php-v

PHP 7.2.34-8+ubuntu20.04.1+deb.sury.org+1 (cli) (built: Oct 31 2020 16:57:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.34-8+ubuntu20.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
    with Xdebug v3.0.1, Copyright (c) 2002-2020, by Derick Rethans

我通过以下步骤获得了与 PHPStorm 2020.2.3 一起使用的 Xdebug v3:

  1. export XDEBUG_SESSION=PHPSTORM

  2. 更新php.init文件

    xdebug.extension=/usr/lib/php/20200930/xdebug.so <== path to your xdebug.so file
    #xdebug.remote_autostart=1
    xdebug.start_with_request=yes
    #xdebug.remote_connect_back=1
    xdebug.discover_client_host=true
    xdebug.remote_cookie_expire_time = 3600
    #xdebug.remote_enable = 1
    #xdebug.remote_host = localhost
    xdebug.client_host=localhost
    #xdebug.remote_port = 9000
    xdebug.client_port = 9000
    xdebug.remote_handler = dbgp
    xdebug.idekey=PHPSTORM
    xdebug.mode = debug
    

    '#'是旧版本(Xdebug 2.x)

  3. 重置apache2:sudo service apache2 restart

PhpStorm 2020.3 支持 XDebug3。 detailed upgrade guide 介绍了如何正确更改您的设置。

就我而言(使用 Docker),我必须更改设置

来自:

; v2.*

[Xdebug]
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=off
xdebug.remote_host=host.docker.internal

;# 9000 is default (not required to set).
xdebug.remote_port=9000

至:

; v3.*

[Xdebug]
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal

;# 9003 is now the default (set this for old PhpStorm settings).
xdebug.client_port=9000