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
  1. #1 by Greg on May 31, 2010 - 6:31 pm

    Thanks for the tip, worked for me.

  2. #2 by Robin Corps on March 29, 2011 - 2:18 pm

    Thanks for this, just had the same issue when upgrading to Ubuntu 10. I forgot about the html_errors setting all together.

  3. #3 by Andy on October 27, 2011 - 7:22 am

    Was stuck deep in xdebug docs, thanks for the tip!

(will not be published)