Tutorial

PHP Debugging Tools

PHP is very well used scripting language in now a days. But PHP does not have any inbuilt debugging tools or extension.

But we have some extensions and tools available which serves the debugging purpose of the PHP.

1) X-Debug

X-Debug is the most used and very useful PHP extension. X-Debug will show the variables on browser very well formmatted. You just have to use [code]var_dump()[/code] for printing the variable.

X-Debug can also be integrated with the eclipse PDT for the maximum use of the X-Debug

For more information about X-Debug, please visit the official site of X-Debug.

2) Zend Debugger

Zend Debugger is also a well known debugger for PHP. Same X-Debug this can also be configured with the Eclipse PDT.

As far as I know, X-Debug and Zend Debugger can not be use together. Zend debugger will also come with Zend Studio.

For more information about Zend Debugger, Please visit the official site for Zend Debugger.

3) FirePHP

This is not the PHP extension. But this is the extension for the firefox. This firefox extension depends on the well known Fire Bug extension. With the use of FirePHP we can log the PHP variables in Firebug console panel.

Here is the sample code to log the variable in console.

[cc lang=”php”]
FB::log(“Log message”);
FB::info(“Info message”);
FB::warn(“Warn message”);
FB::error(“Error message”);
[/cc]

Please check below image for look of the console tab of the Fire bug after executing the above code.

Official Web site.

4) PHP Console

Same as FirePHP, PHP Console is the extension for the Google Chrome. This is also log the PHP errors to console tab of the chrome plus it will also show the popup box in screen to notify the errors and warnings generated in PHP.

This extension uses the PHPConsole class and Lagger class. Please check below image which shows the notification popup and console logging in chrome.

Chrome Extension

Shares:
  • bl_nk
    bl_nk
    September 16, 2011 at 11:45 am

    Here’s a simple and useful tool to replace var_dump:
    http://code.google.com/p/kint/

    Reply
  • Outils de debugueur
    September 21, 2011 at 10:50 pm

    […]  http://localhost/xpertdev/2011/09/php-debugging-tools/ (0 visite) […]

    Reply
  • Jason
    Jason
    September 27, 2011 at 12:18 pm

    Thank you for sharing these debugging tools. I have been using PHP Console and I am satisfied with its features. I would definitely give the tools here a try and have fun with the comparison.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *