Debugging techniques with free tools [updated 30 June]


  • Netbeans PHP 6.* + Xdebug + Firefox (with netbeans extension to server debug with javascript) !
    howto configure with
    Wamp 2.0h:
    – download
    php_xdebug-2.0.4-5.2.8.dll into the Wamp folder
    – open port 9000 in the firewall
    – edit php.ini adding

    [xdebug]
    zend_extension_ts=”c:/wamp/bin/php/php5.2.9-2/ext/php_xdebug-2.0.4-5.2.8.dll”
    xdebug.remote_enable=on
    xdebug.remote_handler=dbgp
    xdebug.remote_host=localhost
    xdebug.remote_port=9000
    xdebug.remote_mode=req

    – now, let’s debug the script with Netbeans choosing “Server side PHP with client side Javascript”. Netbeans will install an extension for firefox which will allows to launch the script in the server (localhost). The extension will “pause” (thanks to extension and javascript) the server execution and it will be possibile to debug with netbeans when the breakpoints (put them in valid lines) will be reached.

    See the screenshot: array debug

    Note: obviously it’s possible to debug the script directly in the php command line (no browsers is needed).

    Tested with Netbeans 6.7, Wamp 2.0h

    see official wiki

  • Eclipse PDT + Xdebug ! both are free. In Eclipse you can set breakpoints, then run the application; when breakpoints are reached, Eclipse will show variable values (tree explorer for multi-level arrays )
  • debug with php code
    function debugAll(var_dump($GLOBALS));
    print
    “[pre]; debugAll(); print [/pre];
  • zend debugger […]
  • […]