IntelliJ IDEA 2017.2 Help

PHP Debugging Session

This feature is supported in the Ultimate edition only.

The following is only valid when PHP Plugin is installed and enabled!

Before you start debugging, make sure that you have a debugging engine installed and configured properly. IntelliJ IDEA 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 Configuring Xdebug and Configuring Zend Debugger.

To open the active php.ini file in the editor:

  1. Open the Settings / Preferences Dialog by pressing Ctrl+Alt+S or by choosing File | Settings for Windows and Linux or IntelliJ IDEA | Preferences for macOS, and click PHP under Languages & Frameworks.
  2. On the PHP page that opens, click browseButton.png next to the CLI Interpreter field.
  3. In the CLI Interpreters dialog box that opens, the Configuration File read-only field shows the path to the active php.ini file. Click Open in Editor.

With IntelliJ IDEA, a PHP debugging session can be initiated either through a debug configuration or without it. The latter approach is also called Zero-configuration debugging. IntelliJ IDEA supports three main ways to initiate a PHP debugging session:

  • You create a PHP Web Application debug configuration, and then IntelliJ IDEA uses its settings to launch the application, open the browser, and activate the debugging engine.
  • You create a PHP HTTP Request debug configuration, IntelliJ IDEA generates a request on its base, and then accesses a specific page through this request.
  • Zero-configuration debugging, when no debug configuration is created at all. Instead, you open the starting page of your PHP application in the browser manually and then activate the debugging engine from the browser, while IntelliJ IDEA listens to incoming debugger connections.

No matter which method you choose, you can specify the scripts requests to which you want IntelliJ IDEA 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.

In this part:

Last modified: 29 November 2017

See Also