XDebug with PHP 7.2 on Ubuntu/Debian & Windows

Mon, 2017-12-25 16:11

PHP 7.2 was released a few weeks ago, and there is no stable release for XDebug yet. Here is quick note how to download/compile XDebug as its current alpha release. It worked well for me, but obviously YMMV.

Ubuntu/Debian with PECL

Pull up your terminal first. Unless you are logged in as root, you will need to prefix sudo to all commands below.

Don't have PECL/PEAR installed?
apt install php-pear

When XDebug is available in PECL for your current PHP version, pecl install xdebug would properly install the extension on your system. Bummer that we only have an alpha release. You are so bad-ass that you install alpha packages without thinking twice: Run this in your terminal to make PECL install alpha releases:
pear config-set preferred_state alpha

Now, run pecl install xdebug, give it some time, and you'd have XDebug neatly prepared for you. Read the last part of the output, follow, and add the corresponding zend_extension=... line to your php.ini file. Restart php-fpm (or Apache if you have it as an Apache module), and you'll have XDebug!

Windows, by downloading the .dll file

Windows users usually install XDebug by downloading the appropriate compiled .dll file from XDebug download page, put it in the PHP extensions directory, and enable it from php.ini file. Version 2.6 will be compatible with PHP 7.2, but it's not listed in that page because of there is only an alpha release.

To grab the .dll file, head over to XDebug's App Veyor CI builds page.Find the appropriate build job for your PHP setup.

App Veyor XDebug builds list

The most common one is shown above. If you are using PHP 32-bit (x86), use the build with ARCHITECTURE=x86. If you are using Nginx or any web server that requires you to use php-fpm, use ones with ZTS_STATE=disable. The highlighted one above will work with PHP 7.2 x64, used with Apache as an Apache module. You can always use any ZTS/NTS version with command line.

In the build log page, find the "Artifacts" tab, and download the ZIP file containing the .dll file.

Configure your php.ini file, and you'll have XDebug enabled!

XDebug on PHP 7.2


A stable version of XDebug 2.6 will be released soon with many bugs fixed. If there is no stable release at the time you are reading this, first make sure you have the latest version of the extension.

Cannot start XDebug along with OPCache
Enable XDebug after OPCache. In your php.ini file, zend_extension=opcache should be placed before zend_extension=xdebug