问题描述
我刚刚在OSX上安装了Xdebug v3.0.0beta1,并试图在PHPStorm 2020.1上使用它,但是我明白了这一点:
Xdebug:[Config]设置'xdebug.remote_enable'已重命名, 请参阅以下网站的升级指南 https://www.postgresql.org/docs/8.2/functions-aggregate.html (请参阅:https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_enable)Xdebug:[Config] 设置“ xdebug.remote_host”已重命名,请参见升级 在 https://xdebug.org/docs/errors#CFG-C-CHANGED(请参阅: https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_host)Xdebug:[Config] 设置'xdebug.remote_mode'已重命名,请参阅升级指南 在https://xdebug.org/docs/errors#CFG-C-CHANGED (请参阅:https://xdebug.org/docs/upgrade_guide#changed-xdebug.remote_mode)Xdebug:[Config] 设置“ xdebug.remote_port”已重命名,请参见升级 在 https://xdebug.org/docs/errors#CFG-C-CHANGED
我的问题是,由于我在PHP.ini文件中对xdebug一无所知,因此应该设置哪些正确的设置以及在哪里进行实际更改。
解决方法
PhpStorm 2020.3支撑XDebug3。有一个detailed upgrade guide如何正确地更改设置。
在我的情况下(使用泊坞),我不得不改变的设置
来自:
; 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
到:
; v3.*
[Xdebug]
zend_extension=xdebug.so
xdebug.mode=debug
xdebug.start_with_request=yes
xdebug.client_host=host.docker.internal
,
我的 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
我通过以下步骤使 Xdebug v3 与 PHPStorm 2020.2.3 配合使用:
-
export XDEBUG_SESSION=PHPSTORM
-
更新 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)
-
重置 apache2:
sudo service apache2 restart
Xdebug 3仅受PhpStorm 2020.3 版本支持,该版本当前处于EAP阶段(早期访问计划),并将在大约1个月的时间内发布。
目前,您要么必须针对2020.1 IDE版本继续使用Xdebug 2.9,要么尝试使用最新的2020.3 EAP版本:https://www.jetbrains.com/phpstorm/nextversion/
Xdebug 3在最新的 EAP#6 版本中受支持:https://blog.jetbrains.com/phpstorm/2020/11/phpstorm-2020-3-eap-6/
对于Xdebug 3升级而言,要更改Xdebug设置(php.ini),请检查此链接:https://3.xdebug.org/docs/upgrade_guide
与Xdebug 3相关的文档当前托管在临时https://3.xdebug.org/域中。
您可以根据需要将2020.1 PhpStorm与Xdebug 3一起使用-只需正确配置Xdebug 3。
在Windows 10上使用Xdebug 3.0.0beta1和PHP 7.4 x64对我来说很好用-参见以下问题:https://stackoverflow.com/a/64820427/783119
看到的那些错误表明您的php.ini中仍然具有Xdebug 2配置值。
,在我的情况下,我具有PHP Storm 2020.2,并且在IDE端没有进行任何更改,但是,在服务器端,我必须进行一些更改
要启用Xdebug 3,您需要设置const
exts = ['.log','.ts'],files = ['a.ts','b.xml','c.log'],res = files.filter(f => exts.some(e => f.endsWith(e)));
console.log(res);
进行逐步调试
在我的特定服务器配置中,我将其设置如下:
- /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 =调试
然后在网站根目录的.user.ini文件中设置以下内容:
xdebug.mode = debug