Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Setup Xdebug, Acquia Dev Desktop, and Netbeans in Windows 7

Parent Feed: 

I usually use linux, but for various reasons I've needed to use windows lately and so I figured I would setup Xdebug, Acquia Dev Desktop, and Netbeans in Windows.  I didn't see much for guides out there but its really pretty easy.

Step 1 - Install Acquia Dev Desktop:

You can install either the D6 or D7 one, because really they are the same and you can just add D6/7/yourflavor to it using its "import" button.

I installed this to "C:\acquia-drupal" and "C:\sites\acquia-drupal".  That way I don't have to worry about the spaces when configing my php.ini files.  Spaces in file directories always seem to cause me issues.  Like so:

Step 2 - Install Netbeans

I just went for the php version.  Once its installed you can download any plugins you want.

Step 3 - Setup Netbeans

This is pretty easy, I just basically followed: http://drupal.org/node/1019816.  Some of the options shown on that url are missing in my netbeans, so I just ignored them.

Also, install whatever plugins you want (git is a good one) from W.  To do this I had to run netbeans as administrator (in windows 7), everytime after that I didnt, but to get it going the first time I had too.

Step 4 - Add your project and config it for debug

The Drupal.org link above shows you how to add a project.  One tweak I would do after you add the project, right click your project > properties > Run configuration > Advanced > Do not open webbrowser.

Step 5 - Setup PHP for xdebug.

I noticed Acquia Dev Desktop had the xdebug extension already in the "C:\acquia-drupal\php5_2\ext" folder so I didn't even have to download it.

All I did was edit my php.ini file.  I added this to the bottom:

[debug]
zend_extension_ts=C:\acquia-drupal\php5_2\ext\php_xdebug-2.1.2-5.2-vc6.dll;
xdebug.remote_autostart=off
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000

You can find a link to your php.ini file opening your Acquia Dev Desktop Control Panel and clicking on Settings, then config tab, then the "edit" button next to the php.ini file.

After you add the above to the php.ini file, stop and start the Acquia Drupal Stack.  Now, go back into setting, config tab, and click the phpinfo link.  This will open a page where you can see if xdebug is setup and working.  If you see anything about xdebug on that page, its probably working.

Step 6 - Install the easy Xdebug plugin for FireFox

This will put 2 little icons in your lower right of firefox, a bug-looking-thing and a green square.

Step 7 - Setup Breakpoints and debug

Boot up Netbeans, Acquia Drupal Stack, and Firefox. 

In firefox, go to the php page you want to debug. 

In netbeans, add breakpoints to where you want to stop.  Then click to the debug button in netbeans:

In firefox, click the green bug (lower right from easy Xdebug) and reload the page.

TADAAA, Netbeans will stop at the breakpoints and show you variables and such.  Very cool.

Conclusion

So there you go.  Pretty quick and easy to get up and running.  If you have any questions just let me know.  I'm not a pro at this stuff but I'll sure try and answer whatever you throw at me.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web