Wednesday, June 03, 2009

Debugging Magento: Vista, XAMPP, & Zend Studio for Eclipse

Here are some notes about what worked for me for being able to debug Magneto in Zend Studio for Eclipse using XAMPP on Vista.

For debugging with PDT & xDebug, use this excellent site. My php.ini for xDebug:
zend_extension_ts = D:\xampp\php\ext\php_xdebug-2.1.0-5.2-vc6.dll

Download the Window's Installer version of XAMPP. I have all 4 programs (MySQL, Apache, FileZilla FTP Server, and Mercury SMTP server) all running as services that boot on startup. Make sure you have at least XAMPP version 1.7.1. Afterwards, follow the EXCELLENT Magento installation instructions by Max Berndt (thanks Max!).

I don't have full notes here, but I do remember that I had a lot of problems, and in the end used the zend debugger from the PDT even though I own a licensed version of Zend Studio for Eclipse. I downloaded org.zend.php.debug.debugger.win32.x86_5.2.15.v20081217.jar from, and used 7zip to open the jar and extract ZendDebugger.dll from the resource/php5 directory, and copied it into C:\xampp\php\ext\. I then commented out all the lines from the [Zend], [XDebug], and [DEBUGGER] sections of the php.ini file. I then added the following 3 lines to the [DEBUGGER] section before rebooting Apache...
I don't remember where I got the exact allow_hosts, but I do know that the default values that I had caused Apache to crash, and the above finally worked for me.
Here you might also want to refer to the article PHP Debug with Zend Debugger And Eclipse PDT Tutorial Part 1.

The following assumes that Magento can be reached from
- From the "Run" menu, select "Debug Configurations"
- On the left, right-click on "PHP Web Page" and select "New"
- Name: Magento
- Server Debugger: Zend Debugger
- PHP Server: Click on the "New" link
- Name: Magento Server, URL (do NOT use localhost - I don't have notes on this, but I'm sure that I had trouble accessing the admin area using local host, and switching to fixed the problem).
- Hit next, going to the Server Path Mapping, and "Add"
- Path on Server: the windows path to your magento dir, e.g. C:\Users\Ed\workspace\magento
- Path in Workspace: /magento
- Click Finish
- Now back in the "Debug Configurations" dialog, set file to magento/
- uncheck "Auto Generate (URL)", and set the path (first part of which is auto-generated) to /magento
- In the "common" tab, click "run" and "debug" for showing in the favorite menus.

Hopefully, the above will work for you...


Anonymous said...

"Name: Magento Server, URL (do NOT use localhost - I don't have notes on this, but I'm sure that I had trouble accessing the admin area using local host, and switching to fixed the problem)."

That is because cookies won't get set on a domain without a period in it (http://localhost/ has no period, while does). For some reason it works in Opera if you HAVE to use localhost...

Nick said...

Thank you Rocinate! Your instructions for Zend Studio for Eclipse worked on magento! Usually this debugger just works out of the box when you setup the project, but for some reason I had to manually specify the settings using your instructions. Thank you!

Ed Eichman said...

I now use phpStorm, and was surprised how easy setting up debugging with xampp was. Might want to give phpStorm a spin some time.