Installing Eclipse for PHP – Troubleshooting Zend and PDT

I had some problems installing my development environment – and it seems I’m not the only one.

For a long time now I’ve intended to look into some server-side languages aside from ASP.NET, and settled on PHP as  it’s widely used, free, runs almost anywhere and there are lots of (hopefully) mature libraries. The first step was choosing an IDE, and I went for Eclipse for pretty much the same reasons as above.

Getting the environment running wasn’t particularly intuitive, but there is one area in particular where it looks to be completely broken – installing the Zend debugger. Normally, this should be installed from within Eclipse from the Help > Install New Software dialog, but when I attempted this, I recieved an error -

An error occurred while collecting items to be installed
session context was:(profile=SDKProfile, phase=org.eclipse.equinox.internal.p2.engine.phases.Collect, operand=, action=).
No repository found containing: osgi.bundle,org.zend.php.debug.debugger,5.3.18.v20110322
No repository found containing: org.eclipse.update.feature,org.zend.php.debug_feature,5.3.18.v20110322

This occurred on both my Windows and OSX machines, and also the OSX machine of a colleague, and from looking on Google, it seems it’s pretty widespread. I’m pretty surprised that this still hasn’t been addressed and after much retrying and muttering of “You wouldn’t get this in Visual Studio”, I came across a work-around that seems to get you past this error and into a working PHP dev environment.

The workaround is on the zend forums, so all credit to the poster, and it’s a fairly involved process so I thought I’d write it up with screenshots in case anyone else runs into the issue and is struggling with the steps.

  1. Step one would be to try the update as normal - if this works (and I assume Zend will fix this in the near future), you’re done.
    Open Eclipse, and select Help > Install New Software and enter the URL of the  Zend Studio Update Site at http://downloads.zend.com/pdt – it should look something like this: 

    Zend Debugger Install Dialog
    If you are able to carry on through the wizard to a complete install without receiving an error like the one above, then congratulations and this is as far as you need to read. For the less fortunate or morbidly curious, proceed to step 2.

  2. Step 2 is to visit the URL (http://downloads.zend.com/pdt) in your browser and manually download the files needed.Zend PDT Download SiteYou should see this page. You first want the ‘features’ jar, so click on the features/ link, and you will be presented with a list of jar files. You want the one where the version corresponds to the version listed in step 1, which in this case is v5.3.18.v20110322, or the file at the bottom of this screen:Zend PDT Features Download Site
    Download that to a new directory on your local machine. Next, go back a page to the /pdt/ level, and click the plugins/ link. There are 2 files you need from here. One is the ‘plugins’ jar, which will have a short name ending in the same version number as before. The other is the ‘platform specific’ jar. This has a longer name also ending in the version number, but the name also contains your OS and possibly your CPU instruction set architecture and bitness. In my case (Windows) I need both the first and last files shown in this screenshot:

    Widows Features jars

  3. Now for the fun stuff – extracting these jars. For each jar, copy the jar name (without the extension) and create a folder with that name. When you are finished, you should have something like this.jar folders
    Next, you need to extract the contents of each jar into the relevant folders – I used WinRAR for this. It’s possible that your extraction utility will be able to create the folders correctly named for you during extraction, if this is the case you won’t need to create the folders manually beforehand. Once this extraction is complete, you can get rid of the jars.
  4. Finally you need to make sure that eclipse can see these folders – this means copying them to the correct sub-directory of your system’s ‘eclipse’ directory – this is typically the directory where you run eclipse from i.e. where the eclipse.exe lives.  If you don’t know here this is, you can right-click your eclipse shortcut > Properties > Shortcut tab > Open File Location. Once you have navigated to that directory you will hopefully see a set of folders and files a bit like this:eclipse directory
    Going back to the three folders that you extracted to earlier, you want to move the one with “feature” in the name into the “features” directory in your eclipse directory, and the other two folders that you extracted go into eclipse’s “plugins” directory.
  5. Finally, restart eclipse and it should pick up the zend debugger install, and you’re ready to rock and roll. If there are still issues, try restarting eclipse with the -clean command line argument, which will force Eclipse to reinitialise the relevant caches, although I’ve never needed to do this.
  6. Go write some PHP!
Tagged , , , , , , , , , ,