Comments on: How To Setup a Free PHP Debugger using Eclipse PDT + XDebug http://robsnotebook.com/php_debugger_pdt_xdebug Sat, 22 Nov 2008 10:52:22 +0000 http://wordpress.org/?v=2.2.3 By: proft.com.ua » Blog Archive » ??????? PHP ???????? ? ??????? XDebug ? Eclipse ? VIM http://robsnotebook.com/php_debugger_pdt_xdebug#comment-45109 proft.com.ua » Blog Archive » ??????? PHP ???????? ? ??????? XDebug ? Eclipse ? VIM Thu, 20 Nov 2008 01:08:25 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-45109 [...] How To Setup a Free PHP Debugger using Eclipse PDT + XDebug [...] […] How To Setup a Free PHP Debugger using Eclipse PDT + XDebug […]

]]>
By: Propiedad Privada » Blog Archive » Enlaces variados de la semana - PHP Y MySQL http://robsnotebook.com/php_debugger_pdt_xdebug#comment-44417 Propiedad Privada » Blog Archive » Enlaces variados de la semana - PHP Y MySQL Fri, 14 Nov 2008 22:33:56 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-44417 [...] Extenso pero simple Tutorial sobre configuración de un Debugger de PHP gratuíto usando Eclipse PDT + XDebug [...] […] Extenso pero simple Tutorial sobre configuración de un Debugger de PHP gratuíto usando Eclipse PDT + XDebug […]

]]>
By: Dritan http://robsnotebook.com/php_debugger_pdt_xdebug#comment-44341 Dritan Fri, 14 Nov 2008 11:00:00 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-44341 Hi. First of all, thanks for this tutorial. I'm a newb at eclipse php. I have just installed and it works. But I see only the global variables. I don't see my lokal variables at the "(x)=Variables" window. For example: $testArray = array(1,2,3); $test=3; //break point here. With "hover" I can see the value of $test, but not $testArray. It only shows that $testArray is an array and has 3 elements Can somebody help me here. Hi.

First of all, thanks for this tutorial.
I’m a newb at eclipse php. I have just installed and it works. But I see only the global variables. I don’t see my lokal variables at the “(x)=Variables” window. For example:
$testArray = array(1,2,3);
$test=3; //break point here.

With “hover” I can see the value of $test, but not $testArray. It only shows that $testArray is an array and has 3 elements
Can somebody help me here.

]]>
By: James L http://robsnotebook.com/php_debugger_pdt_xdebug#comment-42658 James L Wed, 29 Oct 2008 13:29:01 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-42658 Thanks for taking the time to do this, very helpful. I was missing the step of replacing the xdebug DLL that ships with XAMPP to the one from the xdebug site. Wonder why the one that comes with XAMPP didn't seem to work... ? Thanks for taking the time to do this, very helpful. I was missing the step of replacing the xdebug DLL that ships with XAMPP to the one from the xdebug site. Wonder why the one that comes with XAMPP didn’t seem to work… ?

]]>
By: Sathik http://robsnotebook.com/php_debugger_pdt_xdebug#comment-42041 Sathik Thu, 23 Oct 2008 19:51:41 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-42041 Great work... Thanks lot... Great work… Thanks lot…

]]>
By: Arian http://robsnotebook.com/php_debugger_pdt_xdebug#comment-41365 Arian Fri, 17 Oct 2008 20:33:32 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-41365 Thanks for clarification. This article helped a lot. Not sure what differences are. Even differences listed on XDebugs comparision on their site, is pretty much same across the board. Maybe just another choice :) Thanks for clarification. This article helped a lot.
Not sure what differences are. Even differences listed on XDebugs comparision on their site, is pretty much same across the board. Maybe just another choice :)

]]>
By: Rob http://robsnotebook.com/php_debugger_pdt_xdebug#comment-41026 Rob Wed, 15 Oct 2008 01:22:06 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-41026 Hi Arian: For the remote setup that I have on my local LAN, the path mapping is still required. This is because on my local machine, the path to the files is //servername/c$/xampp/htdocs, while on the remote machine it is c:/xampp/htdocs, so the client needs to translate the pathname to the server. From what you write, it seems that your understanding of path mapping on a truly remote system is correct. Glad I was able to help you understand this. Thanks for letting me know that the Zend debugger is also free. Maybe one of these days I will try it out. Do you know of any advantages it offers over XDebug? One of these days when I have time, I'll make newlines appear in my comments. But I just don't have the time to work on it at the moment. Thanks for your comments, Rob Hi Arian:

For the remote setup that I have on my local LAN, the path mapping is still required. This is because on my local machine, the path to the files is //servername/c$/xampp/htdocs, while on the remote machine it is c:/xampp/htdocs, so the client needs to translate the pathname to the server.

From what you write, it seems that your understanding of path mapping on a truly remote system is correct. Glad I was able to help you understand this.

Thanks for letting me know that the Zend debugger is also free. Maybe one of these days I will try it out. Do you know of any advantages it offers over XDebug?

One of these days when I have time, I’ll make newlines appear in my comments. But I just don’t have the time to work on it at the moment.

Thanks for your comments,
Rob

]]>
By: Arian http://robsnotebook.com/php_debugger_pdt_xdebug#comment-40582 Arian Fri, 10 Oct 2008 18:59:03 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-40582 btw anyway to enable converting new lines to line breaks in your blogs comments? maybe manually adding nl2br() in comment output code of your CMS? all my comments get newlines ripped out so looks much less organized :) btw anyway to enable converting new lines to line breaks in your blogs comments?
maybe manually adding nl2br() in comment output code of your CMS? all my comments get newlines ripped out so looks much less organized :)

]]>
By: Arian http://robsnotebook.com/php_debugger_pdt_xdebug#comment-40569 Arian Fri, 10 Oct 2008 16:26:56 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-40569 Hey Rob, Thanks for the followup, had a few more follow up questions if you have some time for another long-winded comment :) >In a remote debugging setup that is not on the same LAN, you would have your local machine running the debugger, and your server machine running the actual site. Eclipse does not access the files on your remote site via ftp..., it only accesses files on your local machine... Therefore, it is very important that you have an exact copy of these files on your local machine. Think i am following you... makes sense remote machine needs breakpoint info from your files and needs to know how to get that info. Just for clarification: In the remote debugging setup like yours though where the workspace files you are debugging in Eclipse are actually on the remote machine itself, do you need to setup server mappings as the server has the exact files you set the breakpoints on? Like since no development in this remote setup occurs locally, Does eclipse need to know mapping of local to remote machine in this case? So let me bring up the situation where it is not on same LAN... im not sure if this is how it would really be setup but ill take a guess, let me know if sounds about right... Pretend You have a project on local dev machine, c:/htdocs. and kinda test there locally (like pretend in Debug settings, you have the PHP Server settings for http://localhost, aka your local webserver with the debugger installed on it). Then you feel comfy testing locally, and might want to transfer the files over to a remote staging or production machine pretend http://stagingserver (a remote machine that also has debugger installed). Then to test via Eclipse, change the Debug settings so it uses that staging PHP Server (with server mappings set), so when you are debugging a webpage with breakpoints, it uses http://stagingserver's debugger to use what breakpoints you currently have open in Eclipse on it's server copy of that file. so i guess if you dont have an updated copy on the server when debugging this way, havoc ensues :). So with a debugger i guess this is how remote debugging works... you setup a breakpoint in local workspace file on line 455 of homepage.php. When debugging in Eclipse, Eclipse sends the info to the server over some sort of communication protocal, http probably (probably sends info like file, linenumber, server mappings) and Zend Debugger on server recieves this info and send info back to you as it debugs with your breakpoints. so a back and forth communication between server debugger, and eclipse. pdt seems to have option to choose Xdebug and Zend builtin to communicate with the server since you can choose either in the PHP Webpage dropdown. sidenote: i was intially wondering how xdebug can do this back and forth communication when a 'XDebug plugin' isnt in Eclipse to establish communication like Zend has a plugin for eclipse. But realized this Zend plugin is totally unrelated to remote debugging. It just installs a standalone PHP Executable's with ZendDebugger for debugging standalone php scripts. aka as said above paragraph, pdt has remote server debugging capability i guess builtin for both of those. btw i understand why workspace didnt default the way it thought. In the Project Location verification screen in one of your screenshots, it says there are already files there, so hence why the Server-Root project is associated with pretend c:/htdocs since it asks you to use existing dir as the project or create a new directory c:/htdocs/Server-Root. btw I think Zend Debugger itself is free (while the Zend IDE isnt), as it is the default php debugger in Eclipse pdt's PHP Executables (plus copied the ZendDebugger.dll to my server and Eclipse debugged fine, think you can just dl the ZendDebugger.dll free and also install the ZendDebugger Plugin into eclipse and should work). Thanks, Arian Hey Rob, Thanks for the followup,
had a few more follow up questions if you have some time for another long-winded comment :)

>In a remote debugging setup that is not on the same LAN, you would have your local machine running the debugger, and your server machine running the actual site. Eclipse does not access the files on your remote site via ftp…, it only accesses files on your local machine… Therefore, it is very important that you have an exact copy of these files on your local machine.

Think i am following you… makes sense remote machine needs breakpoint info from your files and needs to know how to get that info. Just for clarification: In the remote debugging setup like yours though where the workspace files you are debugging in Eclipse are actually on the remote machine itself, do you need to setup server mappings as the server has the exact files you set the breakpoints on?
Like since no development in this remote setup occurs locally, Does eclipse need to know mapping of local to remote machine in this case?

So let me bring up the situation where it is not on same LAN… im not sure if this is how it would really be setup but ill take a guess, let me know if sounds about right…
Pretend You have a project on local dev machine, c:/htdocs.
and kinda test there locally (like pretend in Debug settings, you have the PHP Server settings for http://localhost, aka your local webserver with the debugger installed on it). Then you feel comfy testing locally, and might want to transfer the files over to a remote staging or production machine pretend http://stagingserver (a remote machine that also has debugger installed).
Then to test via Eclipse, change the Debug settings so it uses that staging PHP Server (with server mappings set), so when you are debugging a webpage with breakpoints, it uses http://stagingserver’s debugger to use what breakpoints you currently have open in Eclipse on it’s server copy of that file. so i guess if you dont have an updated copy on the server when debugging this way, havoc ensues :).

So with a debugger i guess this is how remote debugging works…
you setup a breakpoint in local workspace file on line 455 of homepage.php. When debugging in Eclipse, Eclipse sends the info to the server over some sort of communication protocal, http probably (probably sends info like file, linenumber, server mappings) and Zend Debugger on server recieves this info and send info back to you as it debugs with your breakpoints. so a back and forth communication between server debugger, and eclipse. pdt seems to have option to choose Xdebug and Zend builtin to communicate with the server since you can choose either in the PHP Webpage dropdown.
sidenote: i was intially wondering how xdebug can do this back and forth communication when a ‘XDebug plugin’ isnt in Eclipse to establish communication like Zend has a plugin for eclipse. But realized this Zend plugin is totally unrelated to remote debugging. It just installs a standalone PHP Executable’s with ZendDebugger for debugging standalone php scripts. aka as said above paragraph, pdt has remote server debugging capability i guess builtin for both of those.

btw i understand why workspace didnt default the way it thought. In the Project Location verification screen in one of your screenshots, it says there are already files there, so hence why the Server-Root project is associated with pretend c:/htdocs since it asks you to use existing dir as the project or create a new directory c:/htdocs/Server-Root.

btw I think Zend Debugger itself is free (while the Zend IDE isnt), as it is the default php debugger in Eclipse pdt’s PHP Executables (plus copied the ZendDebugger.dll to my server and Eclipse debugged fine, think you can just dl the ZendDebugger.dll free and also install the ZendDebugger Plugin into eclipse and should work).

Thanks,
Arian

]]>
By: Rob http://robsnotebook.com/php_debugger_pdt_xdebug#comment-40463 Rob Thu, 09 Oct 2008 16:49:58 +0000 http://robsnotebook.com/php_debugger_pdt_xdebug#comment-40463 Hi Arian: Thanks for your comment. Yes, the remote server setup that I have documented here is just a remote server on my local network, not one that is accessed via ftp. I haven't debugged in the sandbox of my real site, so I never set that up (maybe someday). My setup is just what I have at home. My home situation is that I have a server machine that doesn't move, while I debug on my laptop - where I can be anywhere in my house. In a remote debugging setup that is not on the same LAN, you would have your local machine running the debugger, and your server machine running the actual site. Eclipse does not access the files on your remote site via ftp (this access is needed in order to display your source when you breakpoint or step), it only accesses files on your local machine. Therefore, it is very important that you have an exact copy of these files on your local machine. If you set a breakpoint in a source file on your local machine via eclipse, eclipse must know how to tell the remote server which file to breakpoint on. This is where the file mapping comes in. With having 2 copies of the files - one on your local machine and one on the remote machine - you tell eclipse how to map the files on your local machine to the remote machine so that breakpoints can be set on the remote machine (based on you manipulating files on your local machine), and also so that when the remote machine hits a breakpoint, it can communicate the correct file that the breakpoint is at to your local machine. If you didn't set the mapping, when you set a breakpoint on source on the local machine, it will communicate the location on your local machine to your remote machine - and it may be under a different directory structure in your remote machine. Your remote machine only knows files in its directory structure - it doesn't know the files on your local machine's directory structure. As a result - you wouldn't hit the breakpoint. My reason for XDebug in this tutorial is simply that it is free. I don't do PHP professionally, it is just a hobby. I therefore don't want to invest money in tools, and am happy with free stuff. I never used Zend, so I can't say whether it is better or not, but since it is a paid product done by a company that makes its money off PHP, I would bet it is probably much better than XDebug. For my uses so far, XDebug has been good enough. Regards, Rob Hi Arian:

Thanks for your comment.

Yes, the remote server setup that I have documented here is just a remote server on my local network, not one that is accessed via ftp. I haven’t debugged in the sandbox of my real site, so I never set that up (maybe someday). My setup is just what I have at home. My home situation is that I have a server machine that doesn’t move, while I debug on my laptop - where I can be anywhere in my house.

In a remote debugging setup that is not on the same LAN, you would have your local machine running the debugger, and your server machine running the actual site. Eclipse does not access the files on your remote site via ftp (this access is needed in order to display your source when you breakpoint or step), it only accesses files on your local machine. Therefore, it is very important that you have an exact copy of these files on your local machine. If you set a breakpoint in a source file on your local machine via eclipse, eclipse must know how to tell the remote server which file to breakpoint on. This is where the file mapping comes in. With having 2 copies of the files - one on your local machine and one on the remote machine - you tell eclipse how to map the files on your local machine to the remote machine so that breakpoints can be set on the remote machine (based on you manipulating files on your local machine), and also so that when the remote machine hits a breakpoint, it can communicate the correct file that the breakpoint is at to your local machine.

If you didn’t set the mapping, when you set a breakpoint on source on the local machine, it will communicate the location on your local machine to your remote machine - and it may be under a different directory structure in your remote machine. Your remote machine only knows files in its directory structure - it doesn’t know the files on your local machine’s directory structure. As a result - you wouldn’t hit the breakpoint.

My reason for XDebug in this tutorial is simply that it is free. I don’t do PHP professionally, it is just a hobby. I therefore don’t want to invest money in tools, and am happy with free stuff. I never used Zend, so I can’t say whether it is better or not, but since it is a paid product done by a company that makes its money off PHP, I would bet it is probably much better than XDebug. For my uses so far, XDebug has been good enough.

Regards,
Rob

]]>