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<br/>xdebug.remote_host="localhost"
    xdebug.remote_port=9000<br />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
    <nature>org.eclipse.php.core.PHPNature</nature>
    , 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.

Link to XDebugPHPIDEGuide.pdf ??

I can't find a link to the pdf document using google??

I am also not having luck getting the xdebug successfully installed according to phpinfo() .... I seem to be following your instructions

It is in the zip

XDebugPHPIDEGuide.pdf is included in zip along with the XDebug for PDT plugin (https://bugs.eclipse.org/bugs/show_bug.cgi?id=169408).
There are all sorts of ways to screw up the XDebug instillation. It took me about a dozen tries (these notes are as much for me as everyone else). Your versions of XDebug & PHP must be compatible. You need to be sure to modify the correct php.ini file (XAMPP installs 3 of them, check phpinfo). You need to get all the paths correct (don't just copy the string "xampp_path" - you need to use your own install path). And you need to comment out any other references to "zend_extension_ts" in the php.ini file. Those were all stumbling blocks for me.

Variable value is not encoding correctlly

In eclipse ide, the variable value is showing a very strange value, for examle:
In code:
$msg = "This is a message";

when debuging, in variable windows, the value of the variable $msg is showing this:

VGhpcyBpcyBhIG1lc3NhZ2U=

what's wrong?

thanks

Simon

It happend to me too, after

It happend to me too, after last xdebug plugin update

Not something I have seen

Not something I have seen, using the Xdebug plugin labeled: "Prebuilt Binary of XDebug V0.1.3 support for PDT RC2 only". You might try contacting the creator of the plugin.

How to contact to the creator?

Thanks

Simon

Var encoding : V0.1.3 is OK

I also had troubles with var encoding using 0.1.4, but everything is OK with previous 0.1.3 - which requires the PDT-RC2 :
http://download.eclipse.org/tools/pdt/downloads/?release=S20070130-RC2

Many many thanks to you for this post, tao, it helped me tremendously :-)

Your welcome

And I updated the post to let people know they should still with version 0.1.3.

cheers,
-t

I still have the problem with var encoding using V0.1.3

Thanks a lot for the feed back.

But I am still having the problem with var encoding using V0.1.3:

My environment:

OS: Windows XP
PHP: 5.2.1
Exclipse: Version: 3.2.1, Build id: M20060921-0945
PDT: 0.7 S20070130-RC2 (0.7.0.v20070130)
XDebug: V0.1.3

Would you tell me if php 5.2.1 has the problem? or do I need to do something in php.ini?

It does look like a Base64

It does look like a Base64 encoding of your variable.

Effectively, when you decode the "VGhpcyBpcyBhIG1lc3NhZ2U=" with a Base64Decoder, you obtain : "This is a message".

Don't know if that bother you again..

Anybody tried this with PDT RC3?

I followed the instructions above, substituting PDT RC3 and then the xdebug plugins 0.2.0.

The problem for me is that after copying the plugins to Eclipse's plugin directory, I started up PDT and went to preferences->PHP->Debug just like it describes in the documentation and I get the error "Error Creation Extension-Point org.eclipse.php.ui.phpPreferenceBlocks".

Anybody else getting a similar error? I'm going to try downgrading and see if that fixes it.

UPDATE: Downgrading fixed the problem

I'm the guy who posted above. When I downgraded to PDT RC2 and plugins 0.1.4 then the problem went away.

PDT RC3 also causing problems

I tried this version and am getting the same error. Have you managed to downgrade yet? If so, was it successful ?

Which version of Java are

Which version of Java are you using ? The Xdebug plugin for RC3 was built using Java 5, so won't work with Java 1.4.2.

XDebug version 0.2.0

XDebug v0.2.0 requires Java 5 to work, so people having problems with unsupported class version are most likely trying to use Java 1.4.2.

PHP/Debug window diferent

Hi all,

I have PDT All-in-One (Eclipse 3.2 + PDT RC3) and my Window/Preferences.../PHP/Debug window is diferent from window showed at page 7 of Dave Debug guide, so I can't set up xdebug in eclipse.
Could anybody help me?

Thanks in advance

Re: PHP/Debug window diferent

i let eclipse(3.2) search for updates and installed all the updates i received. that made eclipse show me the xdebug-part as it's shown in the PDF. so maybe give that a try.

Thank you!

Thanks for putting this guide together. This was a huge help in setting up my local development instance. My only advice to anyone else -- ensure that you have JDK 1.5 installed.

Thanks

Thanks for your help!
One note of caution, though. Extensions is wrongly spelled in your guide as "extentions". Since I copy pasted from here, it took a while for me to figure out why XDebug was not getting installed :)

I am still struggling with the install...but will hopefully get there. You guide is very helpful! Thanks.

Whoops, I have updated the

Whoops, I have updated the spelling in the article. Thanks.

you dont need xdebug

Hi,

you don't really need xdebug imho.

i'm on OSX 10.4.10

first i installed a full pdt build from
http://download.eclipse.org/tools/pdt/downloads/?release=S20070910-RC1

then i made an update through the update manager and installed
http://www.zend.com/pdt#debugger
- Open Eclipse and go to Help-> Software Updates-> Find and Install
- Select "Search for new features to install" and click "Next"
- Create a New Remote Site with the following details:
o Name: PDT
o URL: http://downloads.zend.com/pdt
- Check the PDT box and click "Next" to start the installation

Lastly, make a test project to see if it works :

it did work fine on my box ;)

You are quite right!

Thanks a lot.
it does work fine on my box, too.

babalabo

PDT debugging

hallo
can you tell me please, can you debugg mysql-connected scripst too? and when yes, how have you realised it?
( neku@lycos.de ) thanks in advance for answer

built-in in PDT 1.0

I found your post when doing some reading before installing Eclipse. When I actually went through the motions, I found that Xdebug is now included in PDT 1.0; no need for a plug-in.

FYI for others who go down this path, I posted my notes on my setup (Apache2 & Eclipse on WIn XP) here:
http://maarten.livejournal.com/453300.html

(Thanks again for your work on BAMcamp!)

Some changes happened since

Some changes happened since PDT v.1 so here they are.

Thanks for your help!

Step by Step guide for PDT+XDebug

Here’s a detailed step-by-step article for setting up a PHP debugger using PDT+XDebug:

http://robsnotebook.com/php_debugger_pdt_xdebug

Remote CLI Debugging via Eclipse PDT

On a related note, I was able to get remote CLI script debugging working in Eclipse, though it doesn't support it natively -- http://thenazg.blogspot.com/2008/12/remote-cli-debugging-via-eclipse-pdt.html

Newer version of PHP does not

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.