Whew! I finally got PHP 5.1.1 debugging working with PHPEclipse on Windows XP.
My plan was to use XAMPP for the Apache, PHP, and MySQL part, and then set up PHPEclipse. There are many pages describing how to do this on the net, but getting it working involved some subtleties that took up 1 full day of tweaking.
My setup :
- OS : Windows XP
- XAMPP 1.5.1, i.e.,Â
- MySQL 5.0.18
- Apache 2.2.0
- PHP 5.1.1
- phpMyAdmin 2.7.0 pl1
- Then I installed PHPEclipse (for Eclipse 3.1) using the Update Manager as described on this plog4u page. This was a breeze.
- Then I downloaded and set up DBG and PHPEclipse as described here on plog4u. Of particular mention on this wiki page is Robert Kraske’s php_dbg.dll for PHP 5.1.1, which you will want unless you are ok with building it from scratch.
The whole plog4u wiki, and that page (“Installing the DBG Debugger”) in particular are gems. Thanks to whoever took all the screenshots, man!!
But after I got all the pieces in place as per the instructions on the above pages, I faced some issues. Here’s a list of issues and how I resolved them:
O========= Issues and resolutions ===========O
- Issue : php_dbg.dll was not loading up (How do you know? Use Process Explorer from sysinternals.com and look at the apache process DLLs)
- Resolution : I was working with the wrong php.ini. You have to work with the php.ini in apache/bin, not php/bin !!
- Issue : The eclipse debugger just hangs.
- Resolution : php_dbg.dll was being loaded with zend_extension_ts. You have to use extension=, NOT the zend_extension_ts=
Sample from my apache/bin/php.ini:
;[Zend]
; VJ : this doesn’t work, use extension= in the debugger section
;zend_extension_ts = “C:\xampp\php\ext\php_dbg.dll�
;zend_extension_ts = “C:\xampp\php\zendOptimizer\lib\ZendExtensionManager.dll�
;zend_extension_manager.optimizer_ts = „C:\xampp\php\zendOptimizer\lib\Optimizer“
;zend_optimizer.enable_loader = 0
;zend_optimizer.optimization_level=15
;zend_optimizer.license_path =
[debugger]
extension=php_dbg.dll
debugger.enabled=on
debugger.profiler_enabled=on
debugger.hosts_allow=localhost 127.0.0.1
;debugger.hosts_deny=ALL
debugger.ports=7869, 10000/16
debugger.JIT_host = clienthost
debugger.JIT_port = 7869
- Issue : Eclipse complains An internal error occurred during: “Debug Source lookupâ€?
- Resolution : I was giving the full path to the file in Remote Sourcepath. Instead, you should just give the path up to the directory in which your php file is located.
- Issue : Clicking on the source screws up the PHP Browser display! This is obviously bad, since I will need to see the output web page as well as look around the code!
- Resolution : Uncheck this option in the PHP preferences : “Refresh PHP browser view when opening editor�
I also tried using the debugbreak() method which some people recommended. This works, but native eclipse breakpoints are of course much more convenient.
Thanks. The Refress PHP browser setting was really in the way. I might add that I got an unlisted issue. I got everything working but the variable explorer and the step-functionality was quite unstable. It was because I was using the latest PHPEclipse release labeled as “stable” (I think it was 1.1.7.) The resolution was to use the latest version from CVS (1.1.8 I think).
Comment by PEZ — March 13, 2006 @ 8:29 pm
Hi friend,
Great job but I could not see the debug break in my project and any php varialbles. I could see php PHP DBG Script, PHP Debugger at localhost:10001 and Thread[main] only.
so I hope hear from you soon
thanks a lot
Luciano Lopes
Brazil
Comment by luciano — May 5, 2006 @ 10:34 pm
As Luciano said: Thread[main] only…
Comment by Bjorne — July 17, 2006 @ 3:38 am
Bjorne, Luciano mailed me later explaining that he had got something in php.ini wrong, though he didn’t state what exactly that was. Hope that helps!
Comment by vijucat — July 19, 2006 @ 9:10 pm
Hi,
can anybody use the option Watch on a specific variable in the variables view without an error pop-up. It is something about replacing children.
Comment by westblue — August 22, 2006 @ 12:35 am
Hi,
I have followed install instructions, can get the debugger to stop on breakpoints ok but the variables panel is never populated. Does anyone have any hints / seen this themselves ? Thanks.
Comment by rob — October 10, 2006 @ 11:54 pm
Hi,
@westblue I have the same problem with phpeclipse 1.1.8
@rob Did you open the “original Debug” perspective? I copied the “Debug” perspective to “php_debug” (as I use “Debug” for Java debugging) but that didn’t work. I have to use the “Debug” perspective to see content inside the “Variables” view.
I also have another problem: When I’m in debugging mode – meaning I’m in Debug perspective and the editor highlights the line the script currently is – and I try to go a step further – no matter whether step into, step over or step out – nothing happens. Just when I close the thread tree and reopen it again the editor steps one line further.
To me it seems like the Debug-View (the thread window) and the editor aren’t refreshed correctly. What do you think?
Has somebody already experienced this? Does somebody perhaps a good solution?
Thanks for your help.
Comment by Alex — November 7, 2006 @ 12:02 am
Hi Friend!
I just landed here by googling “eclipse php dbg debugbreak” and I made it with your precious help!
Your page was my last stop before getting it to work! In a desperate attempt i copied your modifications to php.ini into mine and I could finally see the break point magic!
Anyway, the “gem” page you mention is not that helpful… since the mods to php.ini are not complete there.
But the main problem for me was to get the right versions working: that page says you need Eclipse 3.1, but follow the link and find out! It ain’t there! It is nowhere to be found in the Eclipse website! It ceased to exist! That dead parrot has gone to meet the creator
So i read at the PHP Development Studio Forum that maybe upgrading PHPEclipse to 1.1.9 (and that is CVS, unstable version) would work.
I did it. But at the same time that I was upgrading PHPEclipse beyond the stable line, I was having trouble getting the DBG loaded in PHP: the latest PHP supported is 5.1.2… and that means I can’t you use Apache 2.2…
Downgrading the server was a real pain and a real nonsense… I’m not very experienced so downloading, installing and integrating the right versions of apache+php by myself just didn’t work…
So I downloaded half a dozen versions of XAMPP until i got it right: XAMPP 1.5.0 comes with Apache 2.0.55 and PHP 5.0.5 which is fine for me.
But it didn’t work! The DBG was loading according to phpinfo() but not responding to the breakpoints. Even the breakpoint() function was giving the “Call to undefined function”
The problem was that i only had replaced the first line of the ZEND block in php.ini instead of the whole block, like you did!
Thanks Vijucat!
And to help out those that are looking for answers in 2007:
1) Eclipse 3.3.2 + PHPEclipse 1.1.9 (CVS) is working and debugging.
2) But you still need an older version of PHP because DBG only supports up to PHP 5.1.2.
3) So Get Latest Apache 2.0 from apache.org and PHP 5.1.2 from php.net
4) or… Get XAMPP 1.5.0 (from old realeases at sourceforge) if you are like me and can’t handle step 3
There are still some issues unsolved, probably related to the unstable nature of PHPEclipse 1.1.9 CVS, I read they are trying to meet the new debugging model of Eclipse 3.3
tomorrow i try debugging with OO variables and breakpoints scattered around several included files….(wouldn’t need a debugger if it was all plain prints in a flat file anyway)
but now I’m going to get some sleep while this happy smile lasts…
Thanks again
Comment by andrezero — March 2, 2007 @ 11:21 am
I downloaded DBG 2.15.5 dbg modules from http://dd.cron.ru/dbg/downloads.php and there is a version therein called php_dbg.dll-5.1.x which led me to believe that I could get debugging to work with PHPEclipse 1.1.8 and my PHP v5.1.4 but it was not to be. Seeing a php_dbg.dll-5.2.x makes me think that the former limitation with dbg only working with PHP up to v5.1.2 no longer applies. When I try to debug the breakpoints are ignored and I can’t read variables. My Eclipse is 3.1.1 and I am wondering now what is the magical permutation to make this happen…
Comment by David — July 30, 2007 @ 8:44 pm
Back again – I just tried Eclipse 3.3 together with the 1.1.9.CVS-20060920 distribution and got the same miserable result.
:<}
Comment by David — July 30, 2007 @ 9:24 pm
There’s now a dbg 5.2.2x but I still can’t get dbg to load in Eclipse so I don’t know if it works or now. The help here got me as far as I am but things still don’t work.
Here’s the bizarre thing. If I use my browser to go to my test page that has phpinfo() on it. It shows dbg as loaded.
When I run or debug the page inside Eclipse, the phpinfo() output doesn’t show dbg at all.
The version of php is the same and both runs show the exact same php.ini file.
I can’t imagine why dbg is not loading when Eclipse runs php.exe.
Comment by Bob Ray — October 17, 2007 @ 5:08 am
When you load phpinfo()inside eclipse, it use a different version of php.ini which is not the apache using, that’s why you can not find the dbg there, just have a look of the location of the php.ini location inside the phpinfo() page, you will understand.
Comment by jingsong — July 6, 2008 @ 7:22 pm
Wow, thanks, I’ve been working on this for hours and tried pretty much everything I came across. Ironically, your method exactly contradicts every other thing I’ve tried; From this I conclude you are a bold and savvy explorer. Thanks much for recording your experiences.
Comment by Nancy Nicolaisen — October 29, 2008 @ 11:23 am
Hello Everyone:
I am trying to use DBG with myeclipse. Because of some reason it just won’t break and variables window is always empty (I guess may be just because it never breaks). I already have spent too many days on it. ANy help? Thanks
Comment by Mike — November 11, 2008 @ 11:13 am
I should email you about it.
Comment by pee wee herman you tube — July 19, 2009 @ 6:19 am