Theming
Topic

Xdebug

Xdebug is a PHP extension that greatly simplifies the debugging process. Once installed and enabled, Xdebug generates easier to read error messages that include a backtrace. Xdebug also allows you to step through the life cycle of a Drupal page request in incredibly useful ways.

Example tasks

  • Improve the formatting of error messages output to the browser
  • Connect an IDE to allow setting breakpoints and inspecting the request lifecycle
  • Enable and examine an application profile to find inefficiencies

Confidence

Xdebug is a PHP Extension. Generally speaking, it is installed and configured once per server. Once you set it up on your local development server you likely won't have to make any configuration changes at all.

Drupalize.Me resources

Posted on Tuesday, August 3, 2021 - 08:52 by joe

Being able to execute, and step debug, Drupal's test using the PhpStorm UI makes it easier and more efficient to write tests for your projects. Learn how to configure PhpStorm to run Drupal's PHPUnit tests inside of a DDEV environment using docker-compose and a remote PHP CLI Interpreter. This setup will work for both Drupal core and your custom code.

Drupal 7, 8, 9, and 10
More information

Debugging is the practice of troubleshooting an application through the use of tools and processes in order to find and fix bugs, or better understand the underlying code.

Drupal 7, 8, 9, and 10
More information

Development environments provide a sandbox where you can work on your application without affecting the live site.

Guides

Not sure where to start? Our guides provide useful learning tracks for all skill levels.

Navigate guides

External resources

  • Xdebug (xdebug.org)
    • This is the official documentation, including extension downloads for your platform.
  • Configuring Xdebug (jetbrains.com)
    • Another resource from the folks behind PhpStorm. This tutorial will help walk you through the most useful configuration options for Xdebug.
  • Xdebug debugger (Drupal.org)
    • This contains the recommendations and documentation on Drupal.org about setting up Xdebug specifically for use on Drupal projects.