1/3/10

Setting up Eclipse PDT and XDebug

Update (since a lot of people still seem to be coming to this page): The latest version of PDT is 1.0.2, which works with Eclipse 3.3, and it is excellent. The Xdebug plugin is now part of the core package, and the instructions on how to use it are part of the standard help.

I decide to move into the word of real-time debugging today. I have been using the PHPEclipse plug in, but I could not find a 5.1.4 version of the debugger it uses. Fortunately, I was able to get the eclipse PDT (formally PhpIDE) working with XDebug.

  • Pull down the PDT 0.7RC2 all-in-one (includes Eclipse 3.2) – http://download.eclipse.org/tools/php/downloads/
  • Get XDebug (RC3) to match my php (Windows, 5.1.4) – http://xdebug.org/link.php?url=xdebug200rc3-512-win
  • Install XDebug – I am using xampp, so I save the XDebug dll in xampp_path\php\extensions.
  • Enable XDebug – Modified xampp_path\apache\bin\php.ini – comment out existing zend_extension_ts and add
    [xdebug]
    xdebug.remote_enable=1
    xdebug.remote_host="localhost"
    xdebug.remote_port=9000
    xdebug.remote_handler="dbgp"
    zend_extension_ts="xampp_path\php\extensions\php_xdebug-2.0.0rc2-5.1.2.dll"
  • Restart apache, and check phpinfo() to make sure XDebug has been successfully installed
  • Get Dave Kelsey’s XDebug for PDT plugin (version 0.1.3) – https://bugs.eclipse.org/bugs/show_bug.cgi?id=169408
  • Copy plug-in files into Eclipse plugin directory
  • I needed to convert my phpeclipse projects into PDT projects. Close the projects, and edit their .project files, changing their natures to
    org.eclipse.php.core.PHPNature
    , then reopen the projects
  • Lastly, follow the excellent directions in the XDebugPHPIDEGuide.pdf online help to set up a Debug web launch and debug away.

No comments: