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


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

  • Debugging in PhpStorm
    • This video was created by the folks behind PhpStorm. It contains an extremely fast-paced example of the setup and use of Xdebug using the PhpStorm IDE. PhpStorm isn't required to use Xdebug.
  • PHP Applications Profiling in PhpStorm
    • This video demonstrates how Xdebug enables profiling of PHP applications. Again, PhpStorm isn't required to use this Xdebug functionality but it does contain some useful tools to make the process a bit easier.
  • Debug Drupal Code topic
    • While Xdebug is one particular tool that's useful in debugging, there are other techniques you can use to debug your Drupal site. Several of those are covered here.
  • Development Environments topic
    • Many solutions for setting up a local development environment come with Xdebug already enabled and configured, making it even easier to get started using it.

More Guides

We have guides on many Drupal skills and topics.

Explore guides

External resources

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