Developing with PHP and Eclipse (Helios)
Written by Ian Elliot   
Thursday, 24 June 2010
Article Index
Developing with PHP and Eclipse (Helios)
Importing the site
Running and debugging

Running Eclipse

As already mentioned, running Eclipse is just a matter of launching Eclipse.exe. Your first task is to select a workspace. This is where all of the details of your projects are stored.

Notice this isn't the same as where your projects are actually stored and in our case all of the project's source files will be stored on another machine. If you are upgrading create a new workspace.

The first screen you see is the Welcome screen and while this is worth exploring you need to move on to get your project setup. Select the Workbench option, the far right icon, because this is where all of the work is done. There are lots of descriptions of how to create a new project from scratch but few about to import an existing web site and at first it isn't obvious how to do it.


The Welcome page

All you need to do is use the same File,New PHP Project command that you would use to create a project from scratch but you select the Create project from existing source option and then browse to the folder containing the root of the web site. The folder can be local or it can be on a network share.

The name that you give the project is important because it will be used by default to access the website. If you name the project MyProject1 then Eclipse will assume that your website is http://MySite/MyProject1. Don’t worry too much however as there is a way round this - give the site a meaningful name.



New Project

It is also worth checking the Enable JavaScript support for this project but it can increase the time it takes to set everything up. Click Next and be prepared for a potentially long wait - anything from a few minutes to ten depending on the speed of the network connection- as the system examines the files and folders to create the project.

Once the initial scan is complete you have the chance to customise other features of the project such as the include paths etc. In most cases you can ignore all of this and click the Finish button. Again you will have to wait while the system scans but this time it is performing a validation of the PHP and (optionally) the JavaScript in the site. This usually proceeds in the background and you can continue to use Eclipse while it happens but somethings are blocked until the validation is complete. You can see its progress on the status bar at the bottom of the window.



Validation in progress


When this is completed, and again it can take minutes, you are presented with a list of errors and warnings in the Problems window - this much is worth the effort of installing Eclipse! Joomla 1.5 showed 39  errors and 2377 warnings - which sounds alarming but most of them were unmatched <a> tags and other simple things that probably wouldn't make the system crash in the real world. Even so the temptation to fix them to produce clean code is very, very difficult to resist!


You can expand and examine the files and folder structure while the scan is being performed but it is better to be patient and just wait until the validation is complete. If you get an error due to incorrect JavaScript start again with JavaScript support switched off.


The Existing project loaded



Last Updated ( Monday, 30 January 2012 )