Tuesday, November 1, 2011

Configuring XDebug with PHP and Netbeans IDE for Drupal

This is for you if just want to configure Netbeans with XDebug on
Windows whether or not you use Drupal. It also equally applies for
Joomla.

My last experience to configure this on Eclipse wasn't good while
working with Joomla. Since the debugger would frequently stop working.
Later I configured it to work with Zend debugger which was better.

But now I've a new Windows-7 and I needed to configure Xdebug while working on Drupal. And lo! It was so easy and works nicely.
Surprisingly I did pretty less settings to configure it to use it.

My Configuration

  • Xampp: 1.6.8 (one later version was giving some problem so I reverted to this stable one)
  • Netbeans: 7.0.1( newly installed)
  • PHP: 5.2.6
  • OS:Windows-7
  • Webserver: on localhost

Steps


  1. Open php.ini. On Windows it is in <xampp>/apache/bin/php.ini
    or you can find from the xampp page when you go to http://localhost and
    click phpinfo() on the left side.
  2. Search for [Zend] section followed by [XDebug] section. Now
    comment all the [Zend] section by placing semicolon from [Zend] till
    End:. Next uncomment all lines in [XDebug] section. I'm placing a screenshot of these changes(see below).
  3. Download XDEBUG version and place it in <xampp>/php/ext also
    the name of this xdebug...dll should be same as mentioned in the
    [XDebug] section in zend_extension.
  4. Open Netbeans and create a new PHP project selecting the project
    path in the DocumentRoot. While creating project select Local Server(
    and NOT remote server) For Drupal project select full path till Drupal.
    That's it and I did no other configuration.
  5. Now open index.php in the Drupal project and set a breakpoint at a
    valid source code line by right clicking in the file above the line and
    selecting "Toggle breakpoint". Again right click and select in the file
    "Debug". I assume you have a default browser set. Now do the debugging
    to your hearts-ful and when done then go to Debug menu and select
    "Finish debugger session". I did not create file extension to recognize .module as php file in Netbeans.

    No comments:

    Post a Comment