Getting Started with Eclipse PHP Development Tools (PDT)

Eclipse Splash ScreenAre you ready to take a step beyond writing code in a text editor like UltraEdit, BBEdit, or TextMate? Would you like to see those PHP and JavaScript syntax errors in the editor, without transferring files to the server or opening a browser? If so, then you're ready to jump into the world of the IDE — Integrated Development Environment. I'll compare the free, open source Eclipse IDE to a few of its commercial competitors Then we'll go through the steps to install Eclipse PDT All-In-One, the Zend Debugger, JSEclipse, and Subclipse. Why an IDE? Let there be no mistake, I still love BBEdit and TextMate. I use both daily at work and at home for quick edits and I actually wrote this post in TextMate. But if you spend a good portion of your day writing PHP, an IDE will save you time in small increments by highlighting those unbalanced braces and missing semicolons, displaying PHP function arguments, and allowing you to debug your code right in the editor. There are commercial IDEs available and I've use a few of them. I tried an early version of Eclipse with the xored studio but the combo wasn't feature-rich and didn't perform as well as Zend Studio. I later switched from Zend to Active State's Komodo. I've been happy Komodo but it's sluggish performance on my PPC Mac drove me back to giving Eclipse another try. I started using Eclipse with PDT at work about a year and am amazed at how much PDT, formerly PHP IDE, has improved over the past four years. Eclipse is first a Java development environment, but extensions exist for a bunch of other languages, including Perl, Ruby, and Tcl. Okay, enough with the commentary, let's get to it, shall we?

Download and install Eclipse PDT All-In-One

Installation couldn't be easier. Visit the Eclipse PDT download page, select a stable build link, scroll down to the PDT All-in-One section, and select the download for your platform. http://download.eclipse.org/tools/pdt/downloads/ Once the download is complete, unpack and move the 'eclipse' folder to your Applications or Program Files folder. Fire up Eclipse, create a new PHP file or project, and code away.

Install the Zend Debugger

Out of the box, Eclipse provides PHP syntax highlighting, code completion, PHP documentation, phpDoc support, and more. Local and server debugging, however, require the installation of XDebug or Zend Debugger extension. Here's how to enable local debugging with the Zend Debugger.

  1. Select Help->Software Updates->Find and Install
  2. Select Search for new features to install, click Next
  3. Click the New Remote Site button...
    1. Name: Zend Debugger
    2. URL: http://downloads.zend.com/pdt
  4. Zend Debugger now appears checked in the Sites to include in search list, click Finish
  5. The update manager searches for the files to download
  6. All Zend Debugger options should be checked on the Search Results screen, click Next
  7. Agree to the licensing terms, click Next
  8. Select the Zend Debugger in the Features to Install screen, you can change the install location, but the default is recommended, click Finish
  9. Verify the Zend Debugger on the Feature Verification screen, click Install All
  10. After installation you'll be asked to restart Eclipse for the changes to take affect

You should now have a PHP Debug Perspective, complete with variable tracing, breakpoints, and CLI and browser debug output views.

Install JSEclipse

To add improved JavaScript editing abilities to Eclipse, install JSEclipse from Adobe Labs. JSEclipse also provides editing support for popular JavaScript libraries, including YUI, Dojo, Prototype, and more. To install JSEclipse with the Update Manager

  1. Select Help->Software Updates->Find and Install
  2. Select Search for new features to install, click Next
  3. Click the New Remote Site button...
    • Name: JSEclipse
    • URL: http://download.macromedia.com/pub/labs/jseclipse/autoinstall/site.xml
  4. JSEclipse now appears checked in the Sites to include in search list, click Finish
  5. The update manager searches for the files to download
  6. Check the JSEclipse version check box on the Search Results screen, click Next
  7. Agree to the licensing terms, click Next
  8. Select JSEclipse in the Features to Install screen, you can change the install location, but the default is recommended, click Finish
  9. Verify JSEclipse on the Feature Verification screen, click Install All
  10. After installation you'll be asked to restart Eclipse for the changes to take affect

To create a new JS file, select New->File->Other->Web->JavaScript. You should now have code completion and error highlighting for JavaScript files.

Install Subclipse

To add support for Subversion revision management you'll need to install Subclipse from tigris.org, the developers of Subversion. To install, let's use the Update Manager again.

  1. Select Help->Software Updates->Find and Install
  2. Select Search for new features to install, click Next
  3. Click the New Remote Site button...
    • Name: Subclipse 1.2.x
    • URL: http://subclipse.tigris.org/update_1.2.x
  4. Subclipse now appears checked in the Sites to include in search list, click Finish
  5. The update manager searches for the files to download
  6. Check the Subclipse version check box on the Search Results screen. You may need to install dependent extensions for the Subclipse integrations (I didn't select integrations), click Next
  7. Agree to the licensing terms, click Next
  8. Select Subclipse in the Features to Install screen, you can change the install location, but the default is recommended, click Finish
  9. Verify Subclipse on the Feature Verification screen, click Install All
  10. After installation you'll be asked to restart Eclipse for the changes to take affect

To checkout an existing Subversion repository

  1. Select New->File->Other->SVN->Checkout Projects from SVN, click Next
  2. Create a New Repository, click Next
  3. Enter the URL for the SVN repository you want to checkout, click Next
  4. If the repository URL is secure, accept the SSL certificate
  5. Select the folder(s) to checkout
  6. Create a new Project, select the Project type, PHP Project in this case, click Next
  7. Enter a Project name, workspace, and any other project specific settings, click Finish
  8. You'll see an overwrite warning that any SVN repository files with the same names as Eclipse settings files, normally you shouldn't need to worry about this, click OK
  9. The project is checked out of the repository

I've just started to use some of the data integration and design extensions available for Eclipse and will post a followup soon. In the meantime, happy coding!

Related Links

filed under:

Comments

I have ecplipse installed on

I have ecplipse installed on my system, which i use for java development. what changes do i need to make to use the same for php development. Any suggestions most welcome.

Thanks

Finally go it working

With regards to the Zend Debugger, I spent hours and hours trying to get it to work. My problem was that when I tested the debugger, Apache would crash. The issue in the end was not stating all the needed IP addresses in the line zend_debugger.allow_hosts= in the php.ini file. The IP address needed are shown if you go to Windows > Preferences > PHP > Debug > Installed debuggers, then click on Zend Debugger and then the Configure button. Regards Web Assistant

Do we still have to install

Do we still have to install php,apache to run the application is that right
for example to make it work as a web page http://localhost/ExampleProject/Hello.php

Installed, Eclipse and also

Installed, Eclipse and also the debugger.
Was trying to debug a sample program
http://localhost/Awand/Hello.php says "page cannot be displayed"

Question:
Do we still have to install php and apache2

Great article!

This was a great article! It saved me a lot of trouble! I only had one problem, and that was the script. Got an 'Access denied'. I had to download it separately and then run it from the DOS box. It worked :)

Running HTML file in Eclipse

Hi,
I am new in Eclipse. I create a Web project in Eclipse and then create a new HTML file.
But i don't know how could I run that HTML file.

Debug in php file

Do someone know how to debug in php file?
I put some debug points in php file, but it is not effective. Is it because I have error when I install zend debugger? Please help!!

Hi, when I install Zend

Hi, when I install Zend Debugger, I have this error:

!ENTRY org.eclipse.equinox.p2.engine 4 4 2010-03-15 23:26:04.683
!MESSAGE An error occurred while collecting items to be installed
!SUBENTRY 1 org.eclipse.equinox.p2.engine 4 0 2010-03-15 23:26:04.683
!MESSAGE session context was:(profile=epp.package.php, phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Collect, operand=, action=).
!SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2010-03-15 23:26:04.683
!MESSAGE No repository found containing: osgi.bundle,org.zend.php.debug.debugger,5.3.7.v20091116
!SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2010-03-15 23:26:04.683
!MESSAGE No repository found containing: osgi.bundle,org.zend.php.debug.debugger.win32.x86,5.3.7.v20091116
!SUBENTRY 1 org.eclipse.equinox.p2.artifact.repository 4 0 2010-03-15 23:26:04.683
!MESSAGE No repository found containing: org.eclipse.update.feature,org.zend.php.debug_feature,5.3.7.v20091116

Can someone help me to figure out it, thanks a lot

Thanks!

Thanks you so much for this info on eclipse. It was very helpful for me.

Stuck at 57%? Check port 9000

I had problems getting xdebug to work and interact properly with Eclipse/PDT. I kept getting stuck at 57% with the message "waiting for XDebug session" in the progress window of Eclipse/PDT. Xdebug was configured to use port 9000.

It turns out the Checkpoint VPN-1 SecureClient, which is installed on my machine (a WinXP SP3 Windows box) also uses port 9000 and runs as a service. Therefore Eclipse/PDT could never open port 9000 for communication with the xdebug server. I noticed this using netstat -a -b, for those unfamiliar with how to see open ports on windows.

I ended up changing the port used by xdebug to something completely random and assigning that same port to Eclipse/PDT in the PHP -> Debug -> Installed Debuggers of the Preferences menu.

I hope this can help anyone else who is stuck with this very annoying problem.

Thank you so much!~~ This

Thank you so much!~~ This really solved the problem. Finally I made the debugger running. :))

Thanks for sharing!

Thanks for sharing Olivier!

Using Eclipse to debug php files within an existing website

I look after a website, and have a local copy of it on my PC in the folder:

C:\Documents and Settings\foxylady337\My Documents\My Webs\TheWebsite

How should I best configure Eclipse (with XDebug, Apache and PHP) to debug the existing (hand-debugged) PHP files on this site?

On my first attempt, I selected the folder above as the Workspace, but this resulted in a new folder being created within TheWebsite, so I removed the final folder in the path and used:

C:\Documents and Settings\foxylady337\My Documents\My Webs

This allows Eclipse to pick up all the files within the website's folders, but Apache's DocumentRoot is C:\Documents and Settings\...\My Webs\TheWebsite, which seems to be the cause of difficulties I'm having.

What I'd really like to be able to do is set a breakpoint in one of the php files on the site, then open up the site's index.html file with a browser, being bounced back into Eclipse when my browsing reaches the breakpoint.

Is this a realistic aspiration?

First, I've stopped using

First, I've stopped using Eclipse and now use Netbeans. I do seem to remember being able to create projects from existing source folders in Eclipse. I'd look for that option when setting up projects.

As for debugging, this is a bit dated, but it may still be helpful http://robsnotebook.com/php_debugger_pdt_xdebug

Using Eclipse to debug php files within an existing website

Thanks, I'd already stumbled across most of the tweaks that were necessary to get this to work, but "robsnotebook" puts them together in one place.

As you say, it's a bit out of date, and the user interface of Eclipse has changed a bit since then, but I was able to work out what was needed.

One annoyance is that Eclipse seems to forget some settings in between runs - in particular, it forgets that I'm using XDEBUG and goes back to the Zend Debugger, and also forgets to use port 9000 (instead of Zend Debugger's 10000) which prevents breakpoints from working.

Did you choose specifically to move away from Eclipse to NetBeans? I've also looked at using XDEBUG with vim (which is the editor I've been using anyway), but this provides a limited debugging environment, and doesn't (for example) allow changes in variables while stepping through code. It looks as though the vim plugins aren't being maintained or extended, which suggests that the guys who developed them found a better development environment to work in.

I'm an amateur programmer looking after a club website, and although I don't have a programming project on at the moment, I don't want to spend a lot of time assessing a variety of different IDEs.

Many thanks!
foxy

Glad you've got it working

I've been doing a lot of JavaScript programming with jQuery over the past year and wanted an IDE which provided code completion for jQuery functions. I couldn't get later versions of Eclipse to work reliably, as shown here http://2tbsp.com/node/107.

Netbeans provides jQuery support out-of-the box http://2tbsp.com/node/109.

Just managed to get eclipse

Just managed to get eclipse working with svn.
Wasn't easy but your post helped a lot.
Thanks! If anyone has trouble with subclipse on linux check out http://subclipse.tigris.org/ds/viewMessage.do?dsForumId=1046&dsMessageId... to disable password storage.

Regards,
Nick
free rapidshare premium account

Configuring PEAR with MDB2 for EclipsePDT

I needed to install and configure PEAR with MDB2 support in my Windows 7 64 bit computer, so I could use PEAR templates and MDB2 MySQL database abstraction to use wiht EclipsePDT. I found this page with really good step by step tutorial of how to do that. Maybe someone else like me could find it helpful. Here's the link:
http://www.truecms.net.au/blog/mdb2/installing-pear-mdb2-wamp-server-win...

ubuntu 8 Eclipse 3 PDT cannot save file over samba

I wm working on ubuntu 8 and have installed Eclipse 3 with PDT.
I have a samba share that accesses the server over network. I can read the files at the server but cannot write to them.
When I try to write it gives me the error - Save Problems - Save could not be completed.

'If I click on details I get the error - File not a directory'.

However, I can write and save easily from the mounted directory.

Is this a Samba, ubuntu, eclipse or PDT issue?

Not sure

That sounds more like a Samba issue. Almost all of my work is done on local directories or directories mounted over AFP so I haven't had a chance to run across this.

Error Message, PHP

This selection cannot be launched, and there are no recent launches is the error message i keep getting anytime i try to run a php script embedded in HTML. i downloaded PDT

Drag'n'Drop HTML components?

Hello,

Is there any drag'n'drop functionality in Eclipse PDT for HTML components? There is a similar extension for JEE that allows creating JSP pages with HTML tags that might be directly drag'n'dropped through a list with components. Is that possible in the PDT version?

Not that I'm aware of.

Not that I'm aware of.

Help

Hi,

I have followed all the steps that you had mentioned in the article.When i try to execute the php file in my web browser it shows the following error.

"Note that no files will be published to the server "

I have installed All-in-one Eclipse package and the Apache HTTP 2.2.11 web server.Both are working fine individually.But, when i try to run i get the error.Please help me i am new to PHP.

Did you ever get this resolved?

If so, what is the trick to getting it to push files to the server?

I'm new to PHP and Eclipse.

I'm new to PHP and Eclipse. I downloaded the Eclipse PDT all-in-one as instructed and created a simple .php file. When I run the file from inside Eclipse I get the following:

-------------------------------------------------------

This program cannot display the webpage

Most likely causes:
You are not connected to the Internet.
The website is encountering problems.
There might be a typing error in the address.

What you can try:
Check your Internet connection. Try visiting another website to make sure you are connected.

Retype the address.

Go back to the previous page.

More information

This problem can be caused by a variety of issues, including:

Internet connectivity has been lost.
The website is temporarily unavailable.
The Domain Name Server (DNS) is not reachable.
The Domain Name Server (DNS) does not have a listing for the website's domain.

-------------------------------------------------------

I'm not sure what to do next. Do you have any suggestions?

Do you want to run the

Do you want to run the script or debug it? Until you get more familiar with eclipse, it might be better to run/test scripts on a development server. If you're running Mac OS X, you might try these steps to set up a local development server.

Quantum DB

This is a very good article. Any further info or comments on Quantum DB (with MySQL ODBC) or any other way to access/debug an associated DB while developing the PHP that uses it would be greatly appreciated.

So far it seems to me that the Zend PDT does not include a DB plug-in. I'm new at using an IDE for PHP & MySQL, and including more details about the DB would be quite helpful.

Thanks!

A PDT Problem

I've been Googling all afternoon and can't figure out how to solve this:

I keep all of my web projects in a directory, with subdirectories for clients and subdirectories of those for their websites.

When I start a new site, I set up a VirtualHost on my local copy of Apache and give it a name like: projectname.localhost.com, that VirtualHost uses /Users/me/web_work/client_name/project_name as it's DocumentRoot/Directory

So...

Typically, I'll use .htaccess in a site's root folder to include a file, init.php. This file will define all of the paths and include any classes, pear libraries...anything that needs including. It's broken into 2 sections: includes for my local development machine/ includes for the production server.

So, without that .htaccess file being evaluated by apache and apache using the php_auto_prepend value found there...init.php doesn't get included and none of the required files do either.

So, in Eclipse...when I go to debug...nothing works. The debugger is missing all of the required files for the project.

How can I tell an eclipse project to always include certain files when running the debugger?

Also, are there any recommended forums for Eclipse PDT users?

Excellent IDE, hoping to get it's configuration squared away so I can use it to it's full potential.

You want to set up a

You want to set up a debugger as part of your apache server, then use that debugger's plugin in eclipse as a client.

Here's an example of how to do this with XDebug:
http://nalakajayasena.wordpress.com/2007/12/07/debugging-php-with-pdt-an...

Debugging options

Hrm. Not sure on the include question. You might try structuring your init file's host check to check for the production environment first and your not in production, default to development.

Short of that, take a look at setting up server-side debugging on your local dev server. Firebug + FirePHP might be another option.

I haven't really looked for a good PDT forum. If you find one, please share.

Hi, Thank you very much for

Hi,
Thank you very much for this article , grate one

Intellisense is not working

I installed PDT but intellisense is not working for me..Can anybody help me out??

Any hint about running under OpenSuse 11.0 ?

Hello to everybody. When download eclipse-pdt all-in-one and run ./eclipse, I unfortunately get the following :

JVM terminated. Exit code=13
/usr/bin/java
-Xms40m
-Xmx256m
-jar /home/fda/Desktop/eclipse/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
-os linux
-ws gtk
-arch x86
-showsplash
-launcher /home/fda/Desktop/eclipse/eclipse
-name Eclipse
--launcher.library /home/fda/Desktop/eclipse/plugins/org.eclipse.equinox.launcher.gtk.linux.x86_1.0.3.R33x_v20080118/eclipse_1023.so
-startup /home/fda/Desktop/eclipse/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar
-exitdata a70007
-vm /usr/bin/java
-vmargs
-Xms40m
-Xmx256m
-jar /home/fda/Desktop/eclipse/plugins/org.eclipse.equinox.launcher_1.0.1.R33x_v20080118.jar

Could it be possibly related to the fact that I am running the x86-64 version of OpenSuse ?

My version of java seems to be the 1.6.0 :

$ java -version
java version "1.6.0"
IcedTea Runtime Environment (build 1.6.0-b09)
OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)

Any hint about what is going on ? :-/

thanks for information.

thanks for information.

Yes x86-64 problem

I had same issue on ubuntu heron x86-64 when trying to run the allin one package and using iether sun java or open java I got JVM terminated. Exit code=13

I ended up installing eclipse ganymede linux 64 bit version from eclipse downloads then installing pdt seperately.

Works fine now
:-)

I can't see php inside Eclipse

I have installed Eclipse PDT All-In-One on two different computers. On one of them I can see php in the perspectives and everything works fine, but on the other I can't see php anywhere. I have tried everything I could imagine but haven't figured out what the problem is.
It's just weird, but maybe someone has a hint?
Thanks,
Andrea

I have the same problem.

I have the same problem. After upgrading to JDK 1.6, the problem was solved.
Good Luck!

how to save the modifed file to remote system

I've eclipse with rse installed. Am able to navigate and view the files of the remote machine connected. Now after modifying a file it saves to my local machine. I don't know how to save the same file to the remote machine connected..? kindly help me out..

Where is the introduction?

So now I installed PDT and the features, but I was expecting a guide and introduction to most relevant tools and processes when working with this program...

Java 6 update 7

I still don't have PDT :(

no php in eclipse

Hi,
I've copied all files to the eclipse folder but in eclipse there is no mention about php.

Where download JSEclipse

There's no more JSEclipse on adobe .... where should i download it ?

Apparently the JSEclipse update site has changed

I updated the link in the instructions but haven't tested it. Not sure why it changed or if the link I found will continue to be available, if it works.

Please report back if to let folks know if it works or not. I'll try to investigate more when I have time.

Thanks for the links

Thank you very much, the link work ...

Debugger

I followed the install guide from above however when pressing F11 to run debugger, I receive a error stating: "Unable To Launch", "The selection cannot be launched, and there are no recent launches.".

Am I doing something wrong? I am use to UltraEdit with the PHP EXE. You just press a button and it debuggers and outputs any errors.

Thanks
Todd

PDT installs PHP?

Great article. I'm new to Eclipse and was wondering, does the PDT all-in-one package install PHP for you on your computer?

Yes, it does, but...

It installs PHP binaries for running and debugging purposes. These binaries are CLI-only, not the PHP module for Apache.

Take a look at the PHP 4 and 5 binaries in org.zend.php.debug.debugger.macosx_5.2.12.v20071210/resources/

thanks for the help. i'm now

thanks for the help. i'm now up and running with PHP.

hi

Thanks for this detailed articles on installing all these plugins. Being wanting answers for a long time now.Am so glad i stumbled on your website. Great work!!

copyright © 2011, 2 tablespoons | Privacy Policy