06.08.2026 | Michael Ebert

Enable XDebug syntax highlighting in PHP

php.ini
// Default, only plaintext.
xdebug.cli_color=0
// Coloured if your terminal will support it.
xdebug.cli_color=1
// Forced coloured output.
xdebug.cli_color=2

Prerequisite:

You have a setup runnig with PHP XDebug (>= version 2.2) enabled.

Issue:

You want to have a coloured output of a var_dump() or your stack trace when debugging with XDebug.

Solution:

You can enable coloured output of XDebug in your `php.ini` settings.

In mode 1 it tries to automatically detect if your terminal will support it. In mode 2 it will force coloured output, but if your terminal does not support syntax highlighting it might occur that you see some escaped code.

For more information about the settings of XDebug please consider the official XDebug documentation on xdebug.org.