Enable Xdebug HTML Output

I recently updated to Ubuntu 10.04 which includes PHP-5.3 by default. Ever since that upgrade I’ve had trouble with Xdebug not displaying HTML in its output: instead it would output human-readable text which becomes quite unreadable when rendered in the browser without <pre> tags.

Turns out when PHP was upgraded, the php.ini file was replaced, and in the new version, it has the production value for html_errors which is Off. Once I set html_errors=On in /etc/php5/apache, colourful HTML-formatted output was producted by Xdebug.

For the Curious reader, I’m using the following xdebug configuration file, which I’ve located in /etc/php5/conf.d/xdebug.ini to prevent any php.ini changes from overwriting my Xdebug directives. Please note that this is a slightly modified version of the default xdebug configuration included in wamp, which I find to be quite nice:

zend_extension="/usr/lib/php5/20090626/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host="127.0.0.1"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_mode=req
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/tmp/xprofile/"
xdebug.collect_params=On
xdebug.show_local_vars=On