Direkt zum Inhalt

Devbits

Kleine Code-Schnipsel aus unserem Alltag mit Drupal, PHP und DevOps: Problem, Lösung, Code.

06.08.2026 | Michael Ebert

Enable XDebug syntax highlighting in PHP

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

// 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.

22.01.2026 | Marc Hitscherich

Fix SSH warning "Remote host identification has changed" after server move.

If you have moved to a new server and want to access it with SSH via domain name, you will get the warning "Remote host identification has changed" due to changed SSH fingerprints in your `~/.ssh/known_host` file.

# Remove all old entries for my.example.com
ssh-keygen -R my.example.com

# Scan all supported fingerprints from the new server and insert them in your known_hosts file
ssh-keyscan my.example.com >> ~/.ssh/known_hosts

Issue:

If you have moved to a new server and want to access it with SSH via domain name, you will get the warning "Remote host identification has changed" due to changed SSH fingerprints in your `~/.ssh/known_host` file.

The code snippet addresses the challenge of updating SSH fingerprints in the known_hosts file for a server, particularly in cases where the server's keys have been changed, or there are discrepancies with the existing entries.

Solution:

Remove all old entries from the `~/.ssh/known_host` file and insert the new fingerprint(s). Hint: Only do this if you are sure that the new server is under your control.

This code snippet provides a solution to update the SSH fingerprints in the known_hosts file. It first removes any old entries related to a specific hostname (my.example.com) using the ssh-keygen command with the -R option. Then, it scans and appends all supported fingerprints from the new server to the known_hosts file using the ssh-keyscan command.