Jump to content

How do you debug php? Which debugger do you use?


Recommended Posts

I've found some debugger options for PHP:

 

http://xdebug.org/

http://www.php-debugger.com/dbg/

http://phpdbg.com/

http://dbug.ospinto.com/

http://www.firephp.org/

http://pecl.php.net/package/apd

 

And probably there are more. Do you guys know any of these debuggers? Do you recommend one? What is the best PHP debugger?

 

ps: I'm trying to avoid IDEs at the momment, I would like to use a tool specifically made for debugging.

Link to comment
Share on other sites

No one debugs PHP?

Probably more likely is people debug with their IDE's but you said you don't want an IDE so there's not much to say.

 

For step-through logic debugging I use PHPStorm with XDebug. For quicker informational debugging I just scatter some var_dumps around the code.

Link to comment
Share on other sites

You can hook up xdebug to a lot of different editors. With that said, in order for a debugger to work, you need some sort of editor to load code and display it for step through. Most people are using one of the more popular PHP IDE's (PHPStorm, Eclipse PDT/Zend Studio/ Netbeans, etc) and understanding how xdebug works and what you have to do to utilize it isn't exactly point and click, depending on your development setup.

 

For example, I wrote an article on how to get things setup with Eclipse/PDT some years ago, and it's not the easiest thing in the world to get started with. Take a look at it if you're interested.

Link to comment
Share on other sites

I find a plugin for Sublime Text that aparently can enable XDebug inside this text editor. What I need for PHP is something like pudb (for Python), take a look at this pudb print screen:

 

http://asmeurersympy.files.wordpress.com/2010/07/screen-shot-2010-07-28-at-12-51-36-pm.png

 

It runs on terminal and it has these features:

 

1. Execute line by line

2. Show variables values and changes line by line

3. Enable you to navigate between functions stack

4. Can use breakpoints

 

Does XDebug offer this? Is there another debugger for PHP that has these features?

Link to comment
Share on other sites

I find XDebug as not very efficient for myself when I follow object oriented design patterns in my code. It could be very powerful and useful if you're coding in procedural way with bad coding design. I am on Netbeans IDE which is absolutely enough for what I want to do and Vi/VIM as command line  interface code editor.

Link to comment
Share on other sites

Does XDebug offer this? Is there another debugger for PHP that has these features?

XDebug itself doesn't provide any kind of interface for actually interacting with the script. That is the job of a third-party client like your text editor or IDE. On the XDebug website they have a list of clients that will provide this functionality. In the list there is:

XDebugClient - Standalone Windows client.

If you're not using windows, then look at the list for other possible clients. If you feel comfortable with a compiler, the xdebug source package includes a simple client you can compile and use.

  • Like 1
Link to comment
Share on other sites

I find XDebug as not very efficient for myself when I follow object oriented design patterns in my code. It could be very powerful and useful if you're coding in procedural way with bad coding design. I am on Netbeans IDE which is absolutely enough for what I want to do and Vi/VIM as command line  interface code editor.

 

Why isn't XDebug suitable for debuggin Object Oriented PHP?

 

 

XDebug itself doesn't provide any kind of interface for actually interacting with the script. That is the job of a third-party client like your text editor or IDE. On the XDebug website they have a list of clients that will provide this functionality. In the list there is:

 

If you're not using windows, then look at the list for other possible clients. If you feel comfortable with a compiler, the xdebug source package includes a simple client you can compile and use.

 

I'm on Linux and I'm totally comfortable with compiling. How is this simple xdebug client included in the source package? I couldn't find any information about it.

Link to comment
Share on other sites

 

Why isn't XDebug suitable for debuggin Object Oriented PHP?

B/s the main purpose of using XDebug is to brake down your script into small pieces and fragments of data making it much more easy to debuging. By using OO design patterns, that's guarantee (in most cases) that, that data it's encapsulating within a set of functions designed to ensure that the scripts are used appropriately and in a human readable format. 

Link to comment
Share on other sites

It is. I use it on a daily basis with a few large Symfony2 based applications. It's a great tool.

 

http://thorpesystems.com/blog/debugging-php-in-vim

 

I'm pretty interested in taking a look at http://phpdbg.com one of these days too as it ships with PHP5.6.

 

Yes, I was interested in learning phpdbg too since it will be in PHP 5.6 core, but it seems xdebug is better documented, so I'll give it a try at least for now. Thanks for your tutorial!

Link to comment
Share on other sites

  • 2 years later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.