DEV Community

Cover image for Xdebug 3 is here: Massive performance increase, simpler config, and PHP 8 support
James Sansbury for Tugboat

Posted on

Xdebug 3 is here: Massive performance increase, simpler config, and PHP 8 support

If you're using Xdebug for PHP debugging, there's a new version that just released today: Xdebug 3. Check out the announcement! Promising massive performance boosts, a simpler configuration paradigm, and support for the upcoming (tomorrow!) PHP 8.0 release.

Upgrading

To read about how to upgrade from Xdebug 2 to Xdebug 3, read the upgrade guide. Some highlights below:

Performance

The benchmarks of Xdebug 3 have shown that Xdebug 3 is 34% faster for step debugging, and 25% faster when in develop mode. In addition, if you have the Xdebug extension installed, but aren't actively using it (features are disabled), Xdebug 3 is over 99% faster than Xdebug 2.

Configuration highlights

One of the big shifts with Xdebug 3 is the introduction of the xdebug.mode ini setting. If you've ever struggled getting just the correct incantation or flavor of Xdebug ini settings to get debugging working, feast your eyes on this thing of beauty:



xdebug.mode=debug


Enter fullscreen mode Exit fullscreen mode

That's it. No more deciphering if you need remote_enable on, profiler_enable on, or trying to remember what exactly remote_autostart does.

Multiple Xdebug modes

You can combine Xdebug modes together with a comma. These other modes for xdebug.mode are:

  • off Everything is—ahem—off. This means you can have the extension installed but disabled, and a negligible performance hit. ✨ I'm guessing you can't really combine this with the other modes? 🤷‍♂️
  • develop Turns on development aids. If you like stack traces or if var_dump() is your friend, you'll want this setting.
  • coverage If you're running code coverage reports with PHPUnit, turn this on.
  • debug Enables step debugging. 😋
  • gcstats Collect statistics about PHP's garbage collection mechanism. 🗑
  • profile Use this to analyze performance with tools like KCacheGrind.
  • trace Enables the Function Trace feature, which allows you record every function call, including arguments, variable assignment, and return value that is made during a request to a file.

Time will tell, but I'm guessing xdebug.mode on most of my projects will be:



xdebug.mode=develop,debug,coverage

Enter fullscreen mode Exit fullscreen mode




Starting a step debug session

Remember the XDEBUG_CONFIG="idekey=wtf" days? No longer. Now it's simplified to an XDEBUG_SESSION environment variable to turn on step debugging. Set this environment variable to the key you'd like for that step debug session.



XDEBUG_SESSION=wtf

Enter fullscreen mode Exit fullscreen mode




Step debugging? Port 9003

Caution

⚠️ Heads up: the default step debugging port has changed from port 9000 to port 9003.

Win, win, win: performance, simpler config, PHP 8 support

What's not to love about this release? I'm excited to be able to have the extension installed and available without a huge performance hit. I'm looking forward to simpler configuration. And tomorrow, PHP 8.0 will land, which is the first release to have JIT compiling.

Top comments (1)

Collapse
 
dakujem profile image
Andrej Rypo

Thannk you for this post. I was not excited about the new xdebug at all, but now I am. I just hope the migration will not turn into migraines.