How to activate XDebug step debugging
Configure PHPStorm / IDE to accept incoming debug connections
In PHPStorm for example:

By default, the step debugger will activate if a “trigger” is present. If you always want it to activate, set xdebug.start_with_request to yes
.
Trigger the debugger for a web application
Using a browser extension
You can use the following extensions to trigger the debugger:
- Firefox: Xdebug Helper by JetBrains (source).
- Chrome (and Chromium derived browsers): Xdebug Helper by JetBrains (source).
- Edge: Xdebug Helper (source).
- XDebugToggle for Safari (source).
You can tell XDebug to initiate debugging for multiple subsequent requests by setting the XDEBUG_SESSION
cookie.
If you include a XDEBUG_SESSION_START=<any-value>
GET
or POST
param, XDebug will set the XDEBUG_SESSION
cookie for you.
Before XDebug 3.1, the cookie would last for one hour but from version 3.1 onwards, it lasts forever.
You can set the XDEBUG_SESSION_STOP
GET
or POST
param to remove the cookie.
Trigger the debugger for a command line script
Just set the XDEBUG_SESSION
environment variable to any value and run your command. For example
export XDEBUG_SESSION=1 && ./bin/some-script.php
Trigger the debugger via xdebug_break()
You can call xdebug_break() to trigger the debugger as long as xdebug.start_with_request is set to trigger
.
Troubleshoot trigger not working
See here.