How to configure Xdebug for JetBrains PhpStorm 2020.1?

1.9k Views Asked by At

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 :-( )

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

And, here's what PhpStorm says :

enter image description here

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.

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

1

There are 1 best solutions below

10
On BEST ANSWER

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

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

The most important changes are:

  • 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.

Looking down your old config:

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 
   ; renamed xdebug.client_port
   ; also, the default is now 9003 not 9000
   ; so either set to 9000 here, 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.client_port=9000 ; or 9003, but should match the setting in PhpStorm
xdebug.start_with_request=yes
xdebug.idekey="xdebug"
xdebug.log=m:\xdebug.log