skip to Main Content

I’m getting my debugging session polluted from different services. I’m wondering if there’s a way to fix this by using something similar to PhpStorm or just change the ports for each service that I use.

2

Answers


  1. As far as I know there is no such option for VS Code, as it does not have the concept of "registered services".

    You don’t mention how these other services get "triggered", but if you have set-up Xdebug to always make a connection (xdebug.start_with_request=yes) then you might want to have a look at using the default value, and instead use one of the browser extensions to trigger the debugger.

    Login or Signup to reply.
  2. I’m going to assume that you have a big constellation of microservices, where one request triggers a bunch of inter-service calls and you can’t really control debug start with the cookie trigger.
    I’m also going to assume you have a separate project/workspace in vscode for each of those services.

    If each service has their own php.ini (perhaps dockerized) and you can control that, I’d suggest you have each service use their own xdebug.client_port. This way you can start any number of service debug sessions in parallel and there won’t be any conflicts. You can also use the env XDEBUG_CONFIG=client_port=xxxx.

    Another way would be to control the ide key, either via xdebug.idekey or the trigger cookie and use an instance of dbgpProxy and than have VS Code register with that local proxy and control what project uses what ide key.

    There is also an issue asking for this feature, but since you can get to the same functionality with dbgpProxy I have not yet implemented this.

    A third option could be to not aways start the debug process and not even use the browser trigger cookie but simply call xdebug_connect_to_client() in the part of the code you want to debug.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search