- Define a debug configuration of the type PHP Web Application.
- Set the breakpoints, where necessary.
-
Click the Debug button
on the toolbar.
- Examine the application as soon as the debugger suspends on reaching the first breakpoint.
- To control the program execution manually, step through the code using menu commands or toolbar buttons.
- To have the program run automatically up to the next breakpoint, resume the session.
Do one of the following:
-
Specify GET/POST or COOKIE parameters
for Zend Debugger
or
for Xdebug
manually.
-
Generate bookmarklets through which you will start/stop a debugging session by controlling the debugger cookie.
- Open the Project Settings and click PHP. Then click Debug under the PHP node.
- In the Debug page, that opens, click the Use debugger bookmarklets to initiate debugger from your favorite browser link.
-
On the Zend Debugger & XDebug bookmarklets
page that opens,
check the debugging engine settings and click Generate. The bookmarks for listed debugging-related actions are generated.
- Add the generated links to the list of your bookmarks.
- Enable control over the debugger from the browser, if you have not done it yet.
-
To prepare the IntelliJ IDEA for a debugging session,
- Set the breakpoints, where necessary.
-
Toggle the Start Listen PHP Debug Connections button
so it changes its color to green
.
After that IntelliJ IDEA starts listening to the port of the debugging engine used in the current project.
Ports for debuggers are set at the IntelliJ IDEA level in the Debug dialog box (
for Windows and Linux, for Mac OS).
- Open the starting page of your application in the browser.
- To activate the debugging engine from the browser, choose the <debugging_tool> Start session bookmark.
- Re-load the current page (the starting page of the application).
- Switch to IntelliJ IDEA.
- Examine the application as soon as the debugger reaches the first breakpoint and suspends.
- To control the program execution manually, step through the code using menu commands or toolbar buttons.
- To have the program run automatically up to the next breakpoint, resume the session.
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. You can also group such scripts into folders and add these folders to the "ignore list".
- Open the Project Settings, click Debug under the PHP node, then click Skipped Paths.
-
On the Skipped Paths page that opens, configure an "ignore list" of scripts and folders with scripts not to be invoked if IntelliJ IDEA receives incoming connections to them.
-
To add a new entry to the list, click the Add button
or press Alt+InsertCommand N; Command Enter.
Then click the Browse button
and in the dialog box that opens choose the file or folder to skip connections to.
-
To remove an entry from the list, select it and click the Remove button
or press Alt+DeleteCommand Delete.
The script will be now executed upon receiving requests to it.
-
To add a new entry to the list, click the Add button
- To have IntelliJ IDEA inform you every time it receives a request to a script to be skipped, select the Notify about skipped paths check box.
