Rick Seymour

Xdebug in PHP

Xdebug in PHP is speeding up my debuging of code. It allows me to backtrack through errors to see which function they were originally part of. As any web product grows it is sometimes difficult to diagnose where a function call was made that resulted in an error being generated.

Below is a snippet from my error log showing how, well ok, it’s because I used a == instead of an is_() function call.

[01-Mar-2010 08:52:19] PHP Notice:  Undefined index: **VARIBLE*** in ***FILE1*** on line 342
[01-Mar-2010 08:52:19] PHP Stack trace:
[01-Mar-2010 08:52:19] PHP   1. {main}() ***FILE2***:0
[01-Mar-2010 08:52:19] PHP   2. ***FUNCTION1***() ***FILE2***:262
[01-Mar-2010 08:52:19] PHP   3. ***FUNCTION2*** ***FILE1***:223


TIP: Build Xdebug externally and call it in your php.ini file:-

zend_extension=”/FULL_PATH_TO/xdebug.so”

I have tried out APM (PHP Monitoring) but I could not get it to function correctly, however this may be due to conflict with xdebug.

Do you have any recommendations for PHP error log monitoring. Most of the products I have seen have not been worked on in months if not years and with the developments in PHP5.3 and the upcoming PHP6 I would like to have background monitoring and database insertion of errors. (A sexy AJAX interface would be great too!)

Leave your Reply: