2

I am new to xdebug and would like to know if this is possible to debug a php script from Windows command line (applying breakpoints). I have gone through various examples of using xdebug but all they talk about debugging through IDE (Eclipse or Netbeans).

So i am wondering if this is possible to debug scripts using command line (Windows). If this is possible then can someone provide link/URL that provides step by step guidance to achieve this?

Neeraj
  • 8,625
  • 18
  • 60
  • 89
  • Just out of interest: _why_ would one want to do that? Even _if_ you succeed in manually handling the protocol, that would be a really really tough task. Following such debug conversation is more than just a few commands. BTW: kdevelop with its php plugin contains an excellent frontend to xdebug. Just to mention a further alternative. – arkascha Nov 30 '12 at 09:40

2 Answers2

2

The xdebug project page mentions some client implementations, it mentions:

Xdebug 2 is bundled with a simple command line client for the DBGp protocol.

Did you try that one?

arkascha
  • 41,620
  • 7
  • 58
  • 90
  • Thanks for your suggestion but i didn't try any client (either bundled or can be installed separately) so far but was just trying to find a way to debug through command line standalone. If this is the only option then i will surely use something like that – Neeraj Nov 30 '12 at 09:47
  • Sorry, can't follow there... what is mentioned above _is_ a command line client. – arkascha Nov 30 '12 at 09:49
  • If i am using php 5.3.x and just set xdebug properties in php.ini then after that what will i have to do to access that command line client. – Neeraj Nov 30 '12 at 09:53
  • Take a look at this reply: http://stackoverflow.com/questions/13284795/setting-xdebug-breakpoints-solely-in-command-line It uses Linux (as most people here do), but you should be able to adapt that, I guess, though you might have to compile the client first. – arkascha Nov 30 '12 at 10:02
  • That link talks about using command line in Linux but i am using windows. There might be different steps to configure command line client. BTW what is the name of the command line client for Windows? – Neeraj Nov 30 '12 at 10:20
  • I'd say the steps should be more or less the same, no matter what operating system, _if_ you have the toolchain installed you require. As shown in the example it uses the autotools toolchain. That is available for windows and the usage should be pretty much the same. I don't know the name of the cli client, since I never used it (I see no point in that). But it should be really easy to find out by looking at the bundled Makefile. Not more I can say, sorry. Just tried to help. – arkascha Nov 30 '12 at 10:47
2

Xdebug's DBGp protocol is fairly simple. There is a debugging client "debugclient" available for Windows, which used to be linked from the downloads page (http://xdebug.org/download.php) but it seems I had forgotten to add that back. It is still downloadable through http://xdebug.org/files/debugclient-0.9.0.exe

In order to use this, you do need to write DBGp commands. The reference for this is at http://xdebug.org/docs-dbgp.php - this is not an easy thing to do, but it does work.

Derick
  • 35,169
  • 5
  • 76
  • 99
  • 1
    SE is awesome! It's not the first time i see the author answering for his creation. The other one was for phpMyAdmin. And, btw, thank you very much for the extension! – Rafael Barros May 13 '14 at 20:44