PhpStorm 6.0.1 Web Help

2.0+

PhpStorm supports three main approaches to initiating a PHP debugging session:

During the debugging session on the local or remote server, the server side of the debugger tells PhpStorm the name of the currently processed file and the number of the line to be processed. PhpStorm opens the local copy of this file and indicates the line with the provided number. This behaviour is enabled by specifying correspondence between files and folders on the server and their local copies. This correspondence is called mapping.

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. You can also group such scripts into folders and add these folders to the "ignore list".

When using Xdebug, you can also debug PHP applications in the multiuser mode via Xdebug proxy servers.

On this page:

Debugging a PHP application according to a configuration
  1. Define a debug configuration of the type PHP Web Application.
  2. Set the breakpoints, where necessary.
  3. Click the Debug button debug.png on the toolbar.
  4. Examine the application as soon as the debugger suspends on reaching the first breakpoint.
  5. To control the program execution manually, step through the code using menu commands or toolbar buttons.
  6. To have the program run automatically up to the next breakpoint, resume the session.
Enabling control over s debugging session through control over a debugger cookie

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.
    1. Open the Project Settings and click PHP. Then click Debug under the PHP node.
    2. In the Debug page, that opens, click the Use debugger bookmarklets to initiate debugger from your favorite browser link.
    3. 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.
    4. Add the generated links to the list of your bookmarks.
Zero-configuration debugging
  1. Enable control over the debugger from the browser, if you have not done it yet.
  2. To prepare the PhpStorm for a debugging session,
    1. Set the breakpoints, where necessary.
    2. Toggle the Start Listen PHP Debug Connections button start_listening_php_debug_connections.png so it changes its color to green stop_listening_php_debug_connections.png. After that PhpStorm starts listening to the port of the debugging engine used in the current project. Ports for debuggers are set at the PhpStorm level in the Debug dialog box (File | Settings | PHP | Debug for Windows and Linux, PhpStorm | Preferences | PHP | Debug for Mac OS).
  3. Open the starting page of your application in the browser.
  4. To activate the debugging engine from the browser, choose the <debugging_tool> Start session bookmark.
  5. Re-load the current page (the starting page of the application).
  6. Switch to PhpStorm.
  7. Examine the application as soon as the debugger reaches the first breakpoint and suspends.
  8. To control the program execution manually, step through the code using menu commands or toolbar buttons.
  9. To have the program run automatically up to the next breakpoint, resume the session.
Specifying 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. You can also group such scripts into folders and add these folders to the "ignore list".

  1. Open the Project Settings, click Debug under the PHP node, then click Skipped Paths.
  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 Add button add.png or press Alt+InsertAlt+Insert. Then click the Browse button browseButton.png 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 delete.png or press Alt+DeleteAlt+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 check box.

See Also

Procedures:

Reference:

External Links:

Web Resources: