1

There's a shed-load of similar questions and answers out there.

Almost all can be dismissed as referring to Xdebug v2. I am using Xdebug 3.0.0 Release date: 2020-11-25, and everyone else should probably be updating too.

I am trying to achieve in VSC, what I can do in PhpStorm, where I can breakpoint a line of a PHP file which will be invoked as an AJAX call from a JS app which I run in my browser and he IDE will stop on the breakpoint. The important detail here is that I do not run the PHP from the IDE, but from the browser, which builds a rather complex HTTP GET request.

If VSC cannot do that, please post an answer to that effect, and I will give up.

However, since PhpStorm can do it, why not VSC? I imagine that it is mainly a matter of configuration, if VSC or Xdebug has a listener.

This works for PhpStorm:

from PHP.ini:

[Xdebug]

; ---- new, for Xdebug v3, see https://stackoverflow.com/questions/65280429/how-to-configure-xdebug-for-jetbrains-phpstorm-2020-1
; ----- see https://xdebug.org/docs/upgrade_guide

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

xdebug.mode=debug,develop
xdebug.client_host=127.0.0.1
xdebug.remote_port=9000 
xdebug.start_with_request=yes
xdebug.idekey="xdebug"
xdebug.log=m:\xdebug.log

the URL passed in the AJAX request includes XDEBUG_SESSION_START=xdebug as a GET parameter.

Anything else that I need to post? Since it works for PhpStorm, I imagine that I just need to configure VSC - but, how?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
  • So what's your VSCode config is? With your Xdebug config (default 9000 port; local server; start debugging every single script) even a standard config that PHP Debug extension for VSCode provides should just work. – LazyOne Feb 12 '21 at 22:38

0 Answers0