I had always thought of using Eclipse to debug Magento’s complex code flow, and tried number of times before. But without any success I had to abandon it, and thought was not applicable for Magento, remember the fox and the sour grapes
I also tried using Trial Version of Zend Studio, but with no sucess.
But today I was looking at fontis’s blog http://www.fontis.com.au/blog/magento/debugging-with-xdebug and they had indeed used XDebugger and are debugging Magento through command line. So, I thought why not give it a try once again! And as you have already expected i was successfull today!! Wasn’t easy though
Here’s what I’ve done to get it working on WAMP. Before getting this done I assume you have created a new PHP Project and imported all files, beforehand in Eclipse.
Step 1. A very good explanation of downloading Eclipse PDT with Zend Debugger can be found here Installing_the_Zend_Debugger
Step 2. Configuring the Zend Debugger can also be found on same location but I would like to emphasize on its setting here, coz I missed myself on first run
Use these settings for For Zend debugger in php.ini
[Zend]
zend_extension_ts=D:/wamp/bin/php/php5.2.5/ext/ZendDebugger.dll
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always
You should not forget to enable Zend Debugger extension on WAMP. Now restart Wamp. You are now well set with Eclipse PDT and Zend Debugger. Next thing you need to do is make debugging settings in your Eclipse.
Step 3. In you Eclipse Go to Windows–>Preference–>Debug and set as follows

Step 4. Then Windows–>Preference–>Server and set as follows

While setting Server configuration you will be prompt to add server path in path mapping, place that relative to your www root Example: /mysite (which will open as localhost/mysite) and select the files in your workspace.
Step 5. Now all your settings are done. Now let me tell you about debugging a Block Class of Magento, say Mage_Catalog_Block_Product_List. Go to the class file and add a breakpoint anywhere inside _getProductCollection function.
Step 6. Go to Run–>Open Run Dialog and configure as following
Step 7. All set to go now, Run profile as web page Run–>Debug As–>PHP Webpage.
You can now see PHP Debug perspective, and use Step Over or Step Into to debug your values. Here is what I got.
Hope this might be a life changer.. at least it is for me!




really nice post im try right now
Thanks for the post. Like you, I gave up before. I will try again.
Yeha… you should give it a try..once again..
wow this is great if you want to have it working with WAMP. Good for developers who are not really connected often to the internet.
I wish more people would write things like this! Not only is this extremely useful for Magento, but it’s great for anyone using ZEND in general. Excellent information, thanks for taking the time to contribute!
Hello Subesh,
I have been searching through the web to find the solution to build a multi seller module for Magento commerce but with no luck. So I have come up to your blog to seek for help. I am new to Magento but not new to opensource platform and MVC model. I am being locked down to the early stage of module building for multi seller. So if you could lend a helping hand to me it would be great.
By the way nice post. Thanks.
Multiseller Module is yet to be worked out in Magento, there are some payed Module for that.. i guess from Aheadworks! It is a very vast thing So I don’t know where can i help you from..
Thanks Subesh for the quick reply. I have started coding for the multi seller module and so far I was able to build only login html and while inserting into database i got following message:
Can’t retrieve entity config: seller/seller
I can send you the files if you can take a look at it.
Thanks for the response to my post on this blog, but I am sorry to say that.. this page belongs to PDT expanation, so plz email me if you want some help.
Thanks
Thanks for the post, it was helpful. You instructions were good, my only complaint is about how PDT works, not your tutorial, but if you don’t mind I will rant for a quick second.
Seriously, we have to know the file/URL mapping ahead of time in order to debug a Magento/Zend class? That is ridiculous. Sometimes I just want to set a breakpoint and then click around a few webpages and see where that piece of code is called from. From what I can tell, it isn’t possible to do this (PLEASE CORRECT ME IF I AM WRONG!). Jeez.
Maybe it is because I come from a java background and the debugging tools for Java are a little more mature, doesn’t it seem like you should be able to set a breakpoint anywhere in your code and it should just stop there?
Yeha… You’ve made a good point here.. It would be nice if we set breakpoint anywhere and NOT specify the file while debugging. As I’ve mentioned this is the furthest I’ve worked out using Eclipse PDT in Magento.
I am also waiting..for more new technique of doing the same, So if you ever come up with a new way please do share.
Thanks.
I wasted a good day or so trying to figure out another way with PDT and I can’t get it to work like how we are dreaming. On the other hand, I tried out Netbeans + Xdebug and it seems to work a little “better”… I was able to put a breakpoint in without doing a special mapping. Pretty nice. But I decided not to switch over since I am so accustomed to Eclipse and although Netbeans seemed nice, it would take me a while to be as productive.
I got the admin login up in the Zend debugger by debugging the index.php file and editing the URL to be the admin URL and I think it was heading to my breakpoint in the manner you are looking for but on the login it dropped to presenting an Index of file:/// rather than continuing in to the admin code.
The arbitrary break point *should* work via this process. I can get it to work with test form’s and form action php files.
Sorry to tell you that I haven’t been able to work..in admin… plz post back if you are able to do so!
Actually – it works!! Zend added a couple of superfluous slashes in the URL and once removed I can now dip in and out of the debugger as I go through the pages, allowing me to reach arbitrary breakpoints.
Something strange happens in certain file locations – I just get a ! notice message rather than the break – I think magento is hijacking something that the debugger is also using.
Hey Subesh great blogs it helps me alot
Great post, i’ll try this right now…
Thanks,
Hi there!
It seems to work, good stuffff!
But when I start debug it’s shows a dialog that freeze out all the eclipse!
“Page load failed with error: The request timed out.”
And I can’t close it without quitting eclipse.
I had to copy ZendDebugger.so to “MAMP/bin/php/php5/zend/lib/” because i didn’t have it. Running Eclipse PDT MacOS 32…
Since I need to debug cart and checkout process (rounding error in 1.4.0.1), I’ll keep trying.. maybe setting a higher time-out..
I don’t know about setting it up in MacOS.. but yes I used to get timeout as well must be due to load on WAMP/MAMP. If you reload it will work.