Developing with PHP and Eclipse (Indigo)
Written by Ian Elliot   
Monday, 30 January 2012
Article Index
Developing with PHP and Eclipse (Indigo)
Running Eclipse
Debugging

Find out how to make PHP development easy with the latest version of Eclipse, Indigo, and how to set up local and remote debugging.

Eclipse Indigo raises some additional problems for PHP programmers. Up to the Indigo release the PHP Development Tools, PDT could be installed as a single package. However, due to the fact that no package maintainer volunteered for service, there is currently no PDT single package download. What this means is that if you want the latest versions you have to do just a little more work.

The good news is that it isn't difficult.

Getting started

If you have to work with the previous version - Galileo -  or Helios then an older versions of this article is still available at:

Developing with PHP and Eclipse (Helios)
Developing with PHP and Eclipse (Galileo)

 

Banner

 

I know many of us have struggled with coding PHP the hard way using nothing more than an editor and a development installation of the web site - or even worse, the live production site.

Part of the reason is probably that the task of setting up a full development environment, complete with debugger, for PHP seems to be difficult and all the more so if you have an existing and complex PHP website that you would like to take control of.

In my case the website is a PHP/Joomla! site and this provides me with a lot of code that I have never looked at and little really good documentation to tell me how things work.

I've tried working with it with and without Eclipse PHP and all I can say is that the effort in setting Eclipse up was well worth it in terms both of efficiency and in having confidence.

You could say that without Eclipse I was flying blind. With it - I can tackle anything.

So if you have a PHP website or are about to start one - don't hesitate to download the latest Eclipse PHP and do it the logical way.

If you are a beginner to PHP more help can be found in Beginning PHP with Eclipse.

Configuration

Eclipse doesn't have an installation program - it is as close to copy-and-run as it gets.

To install Eclipse you simply download the program, decompress it to a suitable folder and run the main program. You can install multiple copies of Eclipse and run them without worrying about the interactions with the operating system.

You can also use Eclipse PHP in a remote debugging configuration. That is, you can set up a web server with the website installed and then work with the website from a copy of Eclipse installed on another machine. You can also take an existing website and convert it into an Eclipse project. You should however resist the temptation to turn a live production website into an Eclipse project. It is much safer to create a clone development site. 

The range of possible configurations of machines, operating systems and web servers is too big to cover them all so I'm going to focus on using a remote server running Linux/Apache/PHP/MySQL and a development system installed on a local client running Windows.

Other configurations follow the same general steps. In my case the remote server is also a virtual machine and the website is Joomla-based.

I am assuming that the development web server is set up and working and you can browse it as if it was the production website - if any reader thinks that a tutorial on the methods of creating a development site and synchronisation with a production site would make a good topic just email me - Ian.Elliot@i-programmer.info.

If the development website isn't working then don't move on to trying to use Eclipse just yet - get the development website working first.

Get Eclipse

Eclipse is a modular system and while it doesn't need anything by way of installation it certainly does need work when it comes to configuration.

You can spend a lot of time downloading and configuring modules and tracking down missing dependencies.

The simplest solution for the PHP developer used to be to download an all-in-one compressed package that is guaranteed to have all the modules. However from the Indigo release this was no longer possible. So you have to do the installation as a two step process. First install a minimal Eclipse system and then add the PDT package.

The place to start from is the main Eclipse site:

http://www.eclipse.org/

and you will find all of the downloads at

http://www.eclipse.org/downloads/

The one you need for PHP development is the Eclipse Classic.

 

Banner

 

Once you have the file appropriate for the operating system you are working with, eclipse-SDK-3.7.1-win32-x86_64.zip for a 32 bit Windows OS for example, unzip it into a suitable directory. It doesn't really matter where but \Program Files\Eclipse is a reasonable choice under Windows.

To make running the application easier drag the file eclipse.exe to the toolbar or start menu. You don't have to because you can simply run the file in place but it makes things easier to have a shortcut.

<ASIN:1847192823>

<ASIN:0596100655>



Last Updated ( Monday, 30 January 2012 )