Skip to content

Instantly share code, notes, and snippets.

@ProcessEight
Last active January 24, 2022 14:33
Show Gist options
  • Save ProcessEight/3e31f3e5313a0902fb53c129e945f4d0 to your computer and use it in GitHub Desktop.
Save ProcessEight/3e31f3e5313a0902fb53c129e945f4d0 to your computer and use it in GitHub Desktop.
Xdebug 3 research

Xdebug 3 research

Support

Xdebug hooks into PHP's internals deeply in order to offer it's fetures of step debugging, tracing, profiling and others. So each PHP version has a matching Xdebug version.

The latest version of Xdebug, Xdebug 3, only supports PHP versions back to 7.2. However, that's a longer support period than even PHP itself provides.

See the compatibility table for more info: https://xdebug.org/docs/compat#supported-versions

Compatibility with other PHP modules

There are other PHP modules which hook deep into PHP's internals. These are usual not compatible with Xdebug, so should be disabled when running Xdebug:

  • Blackfire
  • Opcache
  • DBG
  • APD
  • ioncube
  • PHP8 JIT

Installation

On bare metal Ubuntu 16.04

There are several ways to install Xdebug. The method you choose will be determined by how much experience you have with Linux and PHP. Here are some pros and cons of each:

  • Using a package manager, e.g. apt. The pro is that is probbaly the easiest way, the con being that if you're on a less-than up-to-date version of Ubuntu, the version in the repository will usually not be the most recent available version, so you'll be missing out on bug fixes, performance improvements and new features.
    • There are third-party repositories which host versions for specific versions of PHP (even those not officially supported by Xdebug or PHP anymore). For Ubuntu, Ondřej Surý's PPA offers this service: sudo apt-get install php7.4-xdebug.
    • If you need a specific version and it's not available in the repository, the only alternative is to compile that version from source.
  • Using PECL: PECL is PHP's own version of a package manager, like apt. Pros: PECL works on OSes which don't have a built-in package manager (like macOS). It can configure PHP as well, so Xdebug will work 'out-of-the-box'. Cons: Configuration is done automatically, so it may change things you're not aware of.
  • Compile from source: Pros: You can get the latest available version, even if you're on an unsupported OS and gives the maximum amount of control over the installation process. Cons: This is much more involved, complex and requires experience of using the Linux terminal.

Compilation from source

Xdebug offers a wizard which ensures you install the right version for the version of PHP you have: https://xdebug.org/wizard.php

I prefer to know the nuts and bolts of my dev stack (i.e. How they work individually and together), so I usually choose this method.

Troubleshooting installation issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment