Debug with PHP exception breakpoints
note
PHP exception breakpoints do not require Xdebug to be configured for working in Just-In-Time mode.
With PHP exception breakpoints, the debugger suspends execution of the application code when an exception or an error is thrown or when a PHP notice or warning is emitted.
Unlike line breakepoints, which you have to set to specific lines in the source code, the configured exception breakpoints apply globally across the codebase. When an exception breakpoint is hit, PhpStorm adds the icon to the respective line of code automatically.
![Hitting an exception breakpoint Hitting an exception breakpoint](https://resources.jetbrains.com/help/img/idea/2024.1/ps_exception_breakpoint_hit.png)
Press or select Run | View Breakpoints from the main menu.
In the Breakpoints dialog, press or click
and select PHP Exception Breakpoints.
In the Add Exception Breakpoint dialog that opens, enter the name of the exception/error type on which you want the debugger to break. The Exception name text input field accepts the following values:
Exception
,Error
, and other PHP's built-in exception classes (for example,TypeError
orParseError
).User-defined classes extending the
Exception
base class (for example,MyException
).Warning
.Notice
.Deprecated
.
Gif
To see the breakpoint type, hover over the breakpoint icon in the editor to display the tooltip.
The Variables pane displays a fake
Exception
variable which shows the exception message and the exception code.To get more information about PHP errors, add a watch to the
error_get_last()
function and examine the details of errors in the Watches pane.