How to debug in phpstorm

In this debugging mode, PhpStorm fully controls the debugging process: it launches the application, opens the browser, and activates the debugging engine according to a PHP Web Page debug configuration.

A PHP Web Page debug configuration tells PhpStorm the URL address to access the starting page of the application, the browser to open the starting page in, and the debug server configuration to use.

You can also specify the scripts requests to which you want PhpStorm to ignore during debugging. This approach can be useful, when your application contains scripts that use AJAX. Suppose you have a menu-ajax-script.php that "reloads" a part of your web page. This script works properly so you do not need to debug it. However, this script is still requested during the debugging session. To have incoming connections to this script ignored, add the menu-ajax-script.php script to the skipped paths list.

Prepare the debugging engine

Before you start debugging, make sure that you have a debugging engine installed and configured properly. PhpStorm supports debugging with two most popular tools: Xdebug and Zend Debugger. These tools cannot be used simultaneously because they block each other. To avoid this problem, you need to update the corresponding sections in the php.ini file as described in Configure Xdebug and Configure Zend Debugger.

Open the active php.ini file in the editor:

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), click PHP.

  2. On the PHP page that opens, click

    How to debug in phpstorm
    next to the CLI Interpreter field.

  3. In the CLI Interpreters dialog that opens, the Configuration file read-only field shows the path to the active php.ini file. Click Open in Editor.

Set breakpoints

Breakpoints are source code markers used to trigger actions during a debugging session. Typically, the purpose behind setting a breakpoint is to suspend program execution to allow you to examine program data. However, PhpStorm can use breakpoints as triggers for a variety of different actions. Breakpoints can be set at any time during the debugging process. Your breakpoints don't affect your source files directly, but the breakpoints and their settings are saved with your PhpStorm project so you can reuse them across debugging sessions.

  1. Place the caret at the desired line of the source code.

    Breakpoints can be set in the PHP context inside php, html, and files of other types. Line breakpoints can be set only on executable lines, but not on comments, declarations, or empty lines.

  2. Do one of the following:

    • Click the gutter area at a line where you want to toggle a breakpoint.

    • From the main menu, choose .

    • Press Ctrl+F8.

Create a debug configuration of the type PHP Web Page

  1. Open the Run/Debug Configuration dialog by doing one of the following:

    • From the main menu, choose .

    • Press Alt+Shift+F10, then press 0 to display the Edit Configuration dialog or select the configuration from the popup and press F4.

  2. Click on the toolbar or press Insert. From the list, select the PHP Web Page configuration type. The PHP Web Page dialog opens.

  3. Specify the configuration name.

  4. Choose the applicable debug server configuration from the Server list or click Browse . and define a debug server configuration in the Servers dialog that opens as described in Create a PHP debug server configuration.

  5. In the Start URL field, type the server path to the file that implements the application starting page. Specify the path relative to the server configuration root ( The server configuration root is the highest folder in the file tree on the local or remote server accessible through the server configuration. For in-place servers, it is the project root. ). The read-only field below shows the URL address of the application starting page. The URL address is composed dynamically as you type.

  6. Specify the browser to open the application in. Choose a configured browser from the Browser list or click Browse and specify another browser in the Web Browsers and Preview dialog that opens.

Initiate a debugging session and examining the suspended program

  1. To start debugging, click the Debug button on the toolbar.

  2. As soon as the debugger suspends on reaching the first breakpoint, examine the application by analyzing frames. A frame corresponds to an active method or function call and stores the local variables of the called method or function, the arguments to it, and the code context that enables expression evaluation. All currently active frames are displayed on the Frames pane of the Debug tool window, where you can switch between them and analyze the information stored therein in the Variables and Watches panes. For more details, see the section Examining a Suspended Program.

  3. Continue running the program and examine its frames as soon as it is suspended again.

    • To control the program execution manually, step through the code using the commands under the Run menu or toolbar buttons:  F7,  Shift+F8,  F8, and others. For more details, see Step through the program.

    • To have the program run automatically up to the next breakpoint, resume the session by choosing or pressing F9.

Specify scripts to skip requests to

This approach can be useful, when your application contains scripts that use AJAX. Suppose you have a menu-ajax-script.php that "reloads" a part of your web page. This script works properly so you do not need to debug it. However, this script is still requested during the debugging session. To have incoming connections to this script ignored, add the menu-ajax-script.php script to the skipped paths list.

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to .

  2. On the Skipped Paths page that opens, configure an "ignore list" of scripts and folders with scripts not to be invoked if PhpStorm receives incoming connections to them.

    • To add a new entry to the list, click the or press Alt+Insert. Then click and in the dialog that opens choose the file or folder to skip connections to.

    • To remove an entry from the list, select it and click or press Alt+Delete. The script will be now executed upon receiving requests to it.

  3. To have PhpStorm inform you every time it receives a request to a script to be skipped, select the Notify about skipped paths checkbox.

Last modified: 01 August 2022

How do I use breakpoints in Phpstorm?

Set method breakpoints Click the gutter at the line where the method is declared. Alternatively, place the caret at the line and press Ctrl+F8 . Alternatively, do the following: Press Ctrl+Shift+F8 or select Run | View Breakpoints from the main menu.

Which hotkeys do you use for managing debugging session in Phpstorm?

In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to PHP | Debug and in the External Connections area, select the Break at first line in PHP scripts checkbox.

How do I start xdebug in Phpstorm?

Configure Xdebug for using in the On-Demand mode.
Disable Xdebug for command-line scripts: In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to PHP. ... .
To enable PhpStorm to activate Xdebug when it is necessary, specify the path to it in the Debugger extension field, in the Additional area..

How do I Debug PHP in Chrome?

Q: How to debug PHP in Chrome? A: You can easily debug PHP in Chrome using a simple extension called PHP Console. Just install this PHP debugging tool from the Chrome web store and start logging errors, warnings, exceptions, and vars dump on your Chrome browser.