IntelliJ IDEA 2018.2 Help

Enabling Profiling with Xdebug

Xdebug profiler is incorporated in the Xdebug tool. Therefore you first need to download, install, and enable Xdebug itself and after that enable the profiling functionality within it.

To enable profiling with Xdebug, perform these general steps:

Enabling the Xdebug profiler

  1. Open the active php.ini file in the editor:
    1. In the Settings/Preferences dialog (Ctrl+Alt+S), click PHP under Languages & Frameworks.

    2. On the PHP page that opens, click browseButton 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.

  2. Do one of the following:
    • To permanently enable the profiler, set the xdebug.profiler_enable directive to 1:

      xdebug.profiler_enable = 1;

    • To enable triggering the profiler from the browser by using the XDEBUG_PROFILE cookie or a GET/POST parameter, set the xdebug.profiler_enable directive to 0, and the xdebug.profiler_enable_trigger directive to 1:

      xdebug.profiler_enable = 0; xdebug.profiler_enable_trigger = 1;

Configuring the way to toggle the profiler from the browser

To specify the XDEBUG_PROFILE cookie or a GET/POST parameter, do one of the following:

  • Specify the values manually.

  • Generate the bookmarklets to toggle the debugger through. These bookmarklets will appear on the toolbar of your browser. They provide control over the debugger cookie, through them you will activate and deactivate the debugger.
    1. Enable the Bookmarks toolbar in your browser by doing one of the following depending on the browser type:
      • In Firefox, choose View | Toolbar | Bookmarks Toolbar.

      • In Chrome, choose Bookmarks | Show bookmarks bar.

    2. In the Settings/Preferences dialog (Ctrl+Alt+S), navigate to Languages & Frameworks | PHP | Debug.

    3. On the Debug page, that opens, click the Use debugger bookmarklets to initiate debugger from your favorite browser link.

    4. 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.

    5. Drag the generated links to the bookmark toolbar in your browser.

Specifying the location for storing accumulated profiling data

  1. Open the active php.ini file in the editor:
    1. In the Settings/Preferences dialog (Ctrl+Alt+S), click PHP under Languages & Frameworks.

    2. On the PHP page that opens, click browseButton 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.

  2. Define location for accumulating profiling snapshots by specifying the xdebug.profiler_output_dir directive.

    xdebug.profiler_output_dir = "<output folder name>"

  3. Specify the name of the file to store snapshots in through the value of the xdebug.profiler_output_name directive. The default name is cachegrind.out.%p, where %p is the name format specifier. Accept the default name or define a custom one in compliance with the following standard:
    1. The name should always be cachegrind.out.

    2. Use the supported format specifiers.

Last modified: 20 November 2018

See Also