0

Xdebug is working with my containers. I can use the debugger to step through the code.

I have the following settings in xdebug.ini:

xdebug.client_host=host.docker.internal
xdebug.discover_client_host=0
xdebug.mode=develop,debug
xdebug.start_with_request=trigger
xdebug.idekey=PHPSTORM
xdebug.output_dir=/app

When I want to trigger Xdebug when I'm hitting an endpoint I just add:

?XDEBUG_SESSION_START=PHPSTORM

in the CLI I do:

export XDEBUG_TRIGGER=1

and then call the a script.

Now my question is how can I trigger the profiler without changing anything in the xdebug.ini. Just have a one off session where the profiler produces a cachegrind file. I've tried adding XDEBUG_TRIGGER=profile to the query string but with no result.

Note, I understand that I can go to the ini add profile to xdebug.mode=develop,debug,profile (adding profile to the list), restart the container and then that will produce the cachegrind.

What I'm really asking is how can I do this via some environment variable with the need to change any setting or restart the server.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
AntonioCS
  • 8,335
  • 18
  • 63
  • 92

1 Answers1

0

From xdebug configuration:

You can also set Xdebug's mode by setting the XDEBUG_MODE environment variable on the command-line; this will take precedence over the xdebug.mode setting, but will not change the value of the xdebug.mode setting.

gadelat
  • 1,390
  • 1
  • 17
  • 25