Debugging
PhpStorm provides a full range of facilities for debugging your source code:
Breakpoints in PHP.
Breakpoints in HTML and JavaScript.
Multiple simultaneous debugging sessions.
Customizable breakpoint properties: conditions, pass count, and so on.
Runtime evaluation of expressions.
Support for Xdebug and Zend Debugger.
This section describes the procedures that are common for various types of applications and PHP frameworks.
Start a debug session
Decide which debugging engine you would like to use: Xdebug or Zend Debugger. On choosing the engine, install and configure it as described in Configuring the debugger engine.
To debug CoffeeScript, TypeScript, and Dart code, you need to generate a source map for it. This will set the correspondence between lines in your original code and in the generated JavaScript code. If no source map is generated, your breakpoints will not be recognized and processed correctly.
Depending on your debugging mode, define a run/debug configuration.
Create breakpoints.
Launch a debugging session as described in PHP Debugging Session. Alternatively, press Shift+F9.
After you've started a debug session, the icon that marks the Debug tool window toggles to to indicate that the debug process is active.
If you want to see the list of all currently debugging applications, select Viewing Running Processes section for details.
from the main menu. Refer to theDebug
After you have configured a run configuration for your project, you can launch it in debug mode by pressing Shift+F9.
In the Debug tool window you can see the list of frames and threads with their states, variables and watches. When you select a frame, you see the variables corresponding to the selected frame.
Debugger session
Run to cursor
Create a breakpoint.
Run a debugging session. To run a debugging session, click the Run Application icon () in the gutter area and select Debug <configuration_name>.
To stop code execution at the cursor position without adding another breakpoint, click the Run to cursor icon () or press Alt+F9. Alternatively, you can click the line number in the gutter area.
The icon is described in the toolbar reference of the Debug tool window.
Configuring debugger settings
-
In the Settings/Preferences dialog Ctrl+Alt+S, use the pages under and .
Useful debugger shortcuts
Action | Hotkey |
---|---|
Toggle breakpoint | Ctrl+F8 |
Resume program | F9 |
Step over | F8 |
Step into | F7 |
Stop | Ctrl+F2 |
View breakpoint details/all breakpoints | Ctrl+Shift+F8 |
Debug code at caret | Shift+F9 (within the main method), or Shift+Alt+F9 |