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. 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: In the Settings/Preferences dialog
(Ctrl+Alt+S), click PHP. On the PHP page that opens, click 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 breakpointsBreakpoints 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.
Create a debug configuration of the type PHP Web Page
Initiate a debugging session and examining the suspended program
Specify scripts to skip requests toThis 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.
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.
|