2

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 ?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
  • 1
    Please READ what the message says. And it says: *"This settings has been changed, see the upgrading guide at https://xdebug.rog/docs/upgrade_guide "*. In short: you are using Xdebug **v3**, it uses DIFFERENT settings than Xdebug v2. You just need to check the upgrade guide and replace certain config params by another (different names). – LazyOne Dec 13 '20 at 20:56
  • 1
    2nd note: Xdebug 3 is supported since 2020.3. It still will wok with previous versions, no issues ... but Xdebug will complain on old (v2) params that IDE sends + PhpStorm will be showing similar screen (as it checks v2 params only). – LazyOne Dec 13 '20 at 20:58
  • Related questions/answers (that I did): https://stackoverflow.com/a/65091404/783119 and https://stackoverflow.com/a/65141934/783119. – LazyOne Dec 13 '20 at 21:04

1 Answers1

3

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
IMSoP
  • 89,526
  • 13
  • 117
  • 169
  • Thanks. I was not aware of this. It is `bed-time o'clock` over here, but I will sort this out in the morning & award the answer. This excellent answer ought to help other future readers of this question. Stay healthy – Mawg says reinstate Monica Dec 13 '20 at 21:04
  • 1
    @IMSoP You should use `lang-ini` instead of `ini` if you want to see syntax colors for those code blocks. Apparently `lang-` prefix is needed for `ini` syntax highligter – LazyOne Dec 13 '20 at 21:09
  • Shoudl I also remove `zend_extension` ? When I do so, I get "no debug extension is loaded", butif I leave it out I still get some of the same old errors. – Mawg says reinstate Monica Dec 13 '20 at 21:14
  • This [accepted answer](https://stackoverflow.com/questions/65091219/enabling-xdebug-in-phpstorm/65091404#65091404) says "`Xdebug 3 will be fully supported in PhpStorm 2020.3 version only, which currently has a RC build and will be released in next few days`" – Mawg says reinstate Monica Dec 13 '20 at 21:36
  • Aha! Maybe if I backgrade to Xdebug v2 ? – Mawg says reinstate Monica Dec 13 '20 at 21:39
  • 1
    Nvm, I upgraded to PHP dtorm 2020.3 and now it works ! Thankses – Mawg says reinstate Monica Dec 13 '20 at 23:23
  • 1
    To be honest, I didn't even know that validation check existed; it's certainly not necessary for that to pass for XDebug to work, so I would have gone with "ignore it and see if the instructions in the migration guide work". – IMSoP Dec 14 '20 at 09:21
  • 1
    @LazyOne Ah, thanks; that seems like a bug in the new markdown integration, but whatever, it looks much better now :) – IMSoP Dec 14 '20 at 09:23
  • @IMSoP OMG! just tested with port 9003 and because that did NOT work either, I tried something new; seems I need to restart Apache each time I change `php.ini` (or at least Xdebug settings). – Top-Master Nov 03 '21 at 16:56
  • 1
    @Top-Master Ah, yes, easily done - if you're running PHP as an Apache module, it only reads php.ini when Apache restarts. – IMSoP Nov 03 '21 at 17:03