PHP Debugging with Breakpoints - case studies, examples..?

31,181

Solution 1

xdebug + remote debugging + one of the supported clients

Solution 2

Use XDebug, it does most of what you require (not network/filesystem), and with it you can debug from eclipse, zend studio, pdt, or even notepad++

I keep debugging again and again when dealing with Magento, and it is super useful in this case, since Magento's function call stack is very deep.

Solution 3

PHP is interpreted and server side scripting language. So, there are only few editors that supports the break point in PHP. And if you are doing the server side scripting then there is no way to debug your script using break points.

However if you are planning to have basic scripting & debugging then you can go with http://www.firephp.org/. Also if you use Zend Studio editor then you will have many options on hand for debugging your script. Zend Studio supports the break point, run & debug options.

I prefer to log the execution of my script in file.

Thanks

Share:
31,181
danp
Author by

danp

Updated on April 16, 2020

Comments

  • danp
    danp about 4 years

    I'd really like to get deeper into my php scripts and use things like breakpoints, as I'm doing with JS with firebug.

    I'd like to know more about what techniques people use, and some solid examples of how to debug with breakpoints a php project.

    Thing's I'd like to be able to see..

    • Properties of objects
    • Class hierarchies.. where objects are coming from, file names etc.. (useful in ZF/Magento)
    • Variables, types, content..
    • headers, post data, get data, session data, cookies..
    • Network / filesystem status..

    I know a lot of this can be done with logging and print_r/vardump etc, but its a bit raw.. and I'd like to be able to use a "continue"/"step-over" etc command on code after hitting a breakpoint, like with firebug.

    from php.ini:

    zend_extension_ts = c:\wamp\bin\php\php5.2.11\ext\php_xdebug-2.1.0-5.2-vc6.dll;
    xdebug.remote_enable=On;
    xdebug.remote_host="localhost";
    xdebug.remote_port=9000;
    xdebug.remote_handler="dbgp";
    
  • danp
    danp almost 14 years
    xdebug looks excellent, along with the windows client. I'm not using one of the supported IDEs (I use E almost exclusively), though.
  • danp
    danp almost 14 years
    As on Wrikken's answer, xdebug looks great, thanks for the tip. I'd still like to see some case studies too!
  • danp
    danp almost 14 years
    Great, thanks. For reference, this is useful overview: brownsofa.org/blog/archives/99
  • Pratik
    Pratik about 9 years
    Read stackoverflow.com/questions/30124782/debug-project-in-phpsto‌​rm
  • Protector one
    Protector one over 6 years
    With this plugin, you can even use Visual Studio Code!