Xdebug 2.7 and the profiler behind a trigger

Loading the extension slows execution substantially even with no session and no profiler running, because it installs hooks into the engine.

; development image only — never in the production one
zend_extension=xdebug.so

xdebug.remote_enable=1
xdebug.remote_autostart=0        ; on request, not always
xdebug.profiler_enable=0
xdebug.profiler_enable_trigger=1 ; ?XDEBUG_PROFILE=1
xdebug.profiler_output_dir=/tmp/profiles

The trigger form means the profiler runs when asked rather than on every request, which is the difference between a usable development environment and one where every page takes four seconds. It ends up in production through a Dockerfile that installs it unconditionally, and nothing announces its presence — so a check in the deploy or on a health endpoint is worth the two lines. A measured 184 requests per second dropped to 61 with it merely loaded.