8

I'd like to see the colors and formatting that can come with var_dump. In my php.ini html_errors is set to On. This is confirmed by phpinfo().

My PHP version is 5.3.3 on Ubuntu 10.10. Anybody an idea?

3 Answers3

17

You're looking for XDebug.

sudo apt-get install php5-xdebug
sudo /etc/init.d/apache2 restart

and you're done.

Maerlyn
  • 33,687
  • 18
  • 94
  • 85
5

Note: Maerlyn's approach should be taken for its simplicity. I wasn't aware of php5-xdebug being in the repos. I've decided to leave this answer because I feel it adds some value to future readers.


    sudo apt-get install php5-dev php-pear

Install Xdebug

    sudo pecl install xdebug

You should see something like: Installing '/usr/lib/php5/20090626+lfs/xdebug.so' when it finishes installing. Make note of the 20090626+lfs portion.

Edit the php.ini

    gksudo gedit /etc/php5/apache2/php.ini

Add this to it:

    zend_extension="/usr/lib/php5/20090626+lfs/xdebug.so"

Restart apache

    sudo /etc/init.d/apache2 restart

Now when you do a var_dump it should be formatted, this is assuming html_errors is On.

Eddie Flores
  • 1,093
  • 13
  • 14
0

you could use a javascript library to do the syntax highlighting. something like: http://alexgorbatchev.com/SyntaxHighlighter/ but there are many other options as well.

Jesse Cohen
  • 4,010
  • 22
  • 25
  • Thanks but this is for a development machine and I'd really like to be able to var_dump variables in PHP without having to load additional Javascript. –  Feb 12 '11 at 23:48