Debugger

PHP 5.6 was the first version of PHP to ship with phpdbg, an interactive debugger that can be used locally on the command-line as well as remotely via client applications. It is inspired by GDB, the de facto standard for debugging UNIX programs, and can be invoked using the phpdbg command.

When you download PHP 7 from https://php.net and build the PHP interpreter yourself, phpdbg is not built by default. You need to pass the --enable-phpdbg option to configure to enable it. If you use a package provided by the vendor of your Linux distribution to manage your PHP environment, then you probably need to install a separate package to get the phpdbg binary.

For PHP 7, phpdbg has been expanded with code coverage functionality. This means that you can now collect, process, and report code coverage data with PHPUnit, for instance, without having to install a third-party extension such as Xdebug or PCOV. To use PHP 7’s built-in code coverage functionality with PHPUnit, just invoke PHPUnit using the phpdbg binary instead of the php binary as shown below:

$ phpdbg -qrr phpunit.phar --coverage-clover coverage.xml tests
PHPUnit 9.2.2 by Sebastian Bergmann and contributors.

............................................

Time: 00:01.788, Memory: 6.00 MB

OK (44 tests, 70 assertions)

Generating code coverage report in Clover XML format ... done

The -qrr command-line option for the phpdbg invocation shown above instructs phpdbg to execute a script and quit after the execution finished without debugging the PHP code that is executed.