如何为 JetBrains PhpStorm 2020.1 配置 Xdebug? [英] How to configure Xdebug for JetBrains PhpStorm 2020.1?

查看:93
本文介绍了如何为 JetBrains PhpStorm 2020.1 配置 Xdebug?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我很高兴地使用 PhpStorm 调试我的 PHP 代码 - 直到 Windows 严重损坏......而且我的备份制度结果并不像我想象的那么好(让这对我们中的许多人来说是一个教训:-( )

So, I was quite happily debugging my PHP code with PhpStorm - until Windows became severely corrupted ... and my backup regime turned out to not quite as good as I had thought (let that be a lesson to many of us :-( )

这是我的 php.ini 的相关部分:

Here's the relevant part of my php.ini:

[PHP]

[Xdebug]

; ---- trying to follow PHP storm's advice

zend_extension = "e:\coding\Web_development\php\php\ext\php_xdebug-3.0.1-7.3-vc15-x86_64.dll"

xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host = 127.0.0.1
;xdebug.remote_port = 9000
;xdebug.remote_mode = req
xdebug.idekey="xdebug"

; ----------   previously worked 
;xdebug.remote_enable=1
;xdebug.remote_host=127.0.0.1
;xdebug.remote_port=9000
;xdebug.remote_autostart=1
;xdebug.remote_handler=dbgp
;xdebug.idekey="xdebug"
;xdebug.remote_log=m:\xdebug.log
;xdebug.profiler_enable=0
;xdebug.profiler_enable_trigger=0
;;xdebug.profiler_output_dir="F:\DropBox\programs\xampp\htdocs\_PHP_profile"
;xdebug.profiler_output_name=cachegrind.out.%s.%t

而且,PhpStorm 是这样说的:

And, here's what PhpStorm says :

但是实际上并不存在其中的大部分内容https://xdebug.org/docs/all_settings - 好像其中一些设置不再相关/支持.

BUT much of that does not actually exist at https://xdebug.org/docs/all_settings - as if some of those settings are no longer relevant/supported.

那么,任何人都可以为 PHP 风暴 2020.1 发布 php.ini 的相关 [Xdebug] 部分吗?

So, can anyone post the relevant [Xdebug] portion of php.ini for PHP storm 2020.1 ?

推荐答案

吸引你的不是 PhpStorm,而是 XDebug: XDebug 3.0 几周前发布,并彻底修改了设置.正如您的屏幕截图中的一条消息所述XDebug 站点上有升级指南

The upgrade that's catching you out here is not PhpStorm, it's XDebug: XDebug 3.0 came out a couple of weeks ago, and has completely overhauled the settings. As mentioned in one of the messages in your screenshot there is an upgrade guide on the XDebug site

看起来 PhpStorm 的检查脚本尚未完全更新,因此建议将新旧设置混为一谈.

It looks like PhpStorm's checking script isn't fully updated yet, so it's recommending a confusing mixture of old and new settings.

最重要的变化是:

  • 新的 xdebug.mode 设置可以一次切换一大堆设置,而不必记住正确的组合.因此,某些设置根本不再需要.
  • 默认端口现在是 9003 而不是 9000,因为其他一些流行软件使用相同的端口.
  • 许多剩余设置已重命名,以便更清晰.
  • The new xdebug.mode setting toggles a whole bunch of settings at once rather than having to remember the right combination. Some settings are simply no longer needed because of this.
  • The default port is now 9003 instead of 9000, because of some other popular software using the same port.
  • A lot of remaining settings have been renamed to be clearer.

查看您的旧配置:

zend_extension = "e:\coding\Web_development\php\php\ext\php_xdebug-3.0.1-7.3-vc15-x86_64.dll"
   ; this tells PHP to load the XDebug extension
   ; note that the file name includes the version number, confirming that you're using v3
xdebug.remote_enable=1 
   ; now implied by xdebug.mode=debug
xdebug.remote_host=127.0.0.1 
   ; renamed xdebug.client_host
xdebug.remote_port=9000 
   ; no longer the default! either keep this setting, or tell PhpStorm to use port 9003
xdebug.remote_autostart=1 
   ; replaced with xdebug.start_with_request=yes
xdebug.remote_handler=dbgp 
   ; no longer needed, as there was only one valid value
xdebug.idekey="xdebug" 
   ; still supported, but not usually needed
xdebug.remote_log=m:\xdebug.log 
   ; replaced by xdebug.log
xdebug.profiler_enable=0 
   ; now implied by xdebug.mode=debug
xdebug.profiler_enable_trigger=0 
   ; now implied by xdebug.mode=debug
xdebug.profiler_output_dir="F:\DropBox\programs\xampp\htdocs\_PHP_profile" 
   ; not needed for debugging
xdebug.profiler_output_name=cachegrind.out.%s.%t 
   ; not needed for debugging

所以我相信你的新配置应该是这样的:

So your new config should I believe look like this:

zend_extension = "e:\coding\Web_development\php\php\ext\php_xdebug-3.0.1-7.3-vc15-x86_64.dll"
xdebug.mode=debug
xdebug.client_host=127.0.0.1
xdebug.remote_port=9000 ; or 9003, but should match the setting in PhpStorm
xdebug.start_with_request=yes
xdebug.idekey="xdebug"
xdebug.log=m:\xdebug.log

这篇关于如何为 JetBrains PhpStorm 2020.1 配置 Xdebug?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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