How to setup Eclipse with PHP PDT, Remote System Explorer, Theme Manager, and Drupal Plugins
patrick — Sun, 07/24/2011 - 21:55
Recently I decided to package eclipse pre configured with this tutorial and offer it for purchase. You can purchase it above, or you can run through the tutorial yourself, enjoy! If you decide to purchase you will have to make sure you still do step 8, there is no way for me to package that.
Update...this configuration still works with Eclipse Juno.
We all know that Eclipse works great with java, but I have always wanted to use it with PHP and more importantly for developing with Drupal. I've tried so many times to get it to work in the past with something always not working right. I finally have figured out a nice smooth setup for using PHP, Eclipse, and Remote System Explorer, and Drupal. Also with an added bonus of the Theme Manager plugin.
One of the challeges that I faced was that I sometimes want to do work on remote servers and I never knew how to do that with Eclipse. Remote System Explorer plugin was the answer to that. It's a very nice plugin once you get use to it. You can have multiple connections setup to multiple servers and easily navigate all of them at once. Remote System also allows you to browse the local file system. Remote System basically lets you break out of the Eclipse 'project' mentality and use it more as a hgh powered text editor.
Alright well on to the tutorial. Please follow these step by step instruction to get it all working. Should only take about 10mins to set it up.
I set this up on Mac OSX 10.6, but this setup should work for windows and linux as well. If you have trouble on windows or linux, please leave a comment and I will investigate.
Step 1: Download and Install Eclipse
Go to http://www.eclipse.org/download and download 'Eclipse Classic' (Don't download Eclipse PHP package), at the time of writing this Indigo (3.7) was the most current release.
Once downloaded, un tar ball/unzip and install Eclipse.
Next start up eclipse and choose your workspace folder.
Step 2: Settings up PHP PDT Plugin
Alright once you have Eclipse up and running, your going to want to navigate to 'Help > Install New Software'.
This will bring you to a screen like so

If you look twords the top of that window you will see a drop down that says 'Wok With', click that and select '--All Available Sites--'.
Next you are going to want to search for 'PHP', this will list the same plugin in three different categories. Just select the first one that says 'PHP Development Tools (PDT)...' and then click 'Next' and run though the install process. Its is pretty straight forward. It will ask you to restart Eclipse click 'Restart Now'. Thats it you now have the PHP PDT plugin installed. This plugin by its self is not super useful because of the way the it is encased in Exlipses 'project' mentality.
From here on out when ever I say go and install new software, you should follow these steps.
Step 3: Install Remote System
You are going to follow the same instruction as above, but you are going to search for 'Remote System', remeber to select '--All Available Sites--' in the 'work with' drop down. Click 'Remote System Explorer End-User Runtime' and 'Remote System Explorer User Actions' and run through the install process like before.

Step 4: Install Theme Switcher (Optional)
The setup for the theme switch is same as the above EXCEPT next to the 'work with' drop down you will see a 'add' button, click that. Fill out the form and enter this as the 'Location':
http://eclipse-color-theme.github.com/update

click ok, and in the list of available plugins to install you should only see one choice 'Eclipse Color Theme'. Check the box and run through the install process, it may give you a warning about installing software from outside sources, just click ok and continue.
Once Eclipse Theme is install you can navigate to Ecplise Preference, on mac they are in 'Eclipse > Preferences', on windows I think they are in 'File > Preferences'.
This will open a window with tons of options. All I want you to be aware of at this point is under 'General > Appearance > Color Theme'. This was added by the theme plugin. Here you can change your theme to what ever you prefer.

Step 5: Install Drupal plugin (Optional)
I work a lot with the content management system Drupal and thought it would be nice to note that there is an Drupal Eclipse Plugin.
To install the plugin it is going to be similar to the theme plugin above. Navigate to 'Help > Install New Software' and add a new site like above and enter the location as:
http://xtnd.us/downloads/eclipse
Again after adding this new location you will be prompted with only once choice. Just select 'Drupal for Eclipse' and run though the setup.

Step 6: Configuring PHP
By defualt in Eclipse 3.7 and greater php file will not automatically open in Eclipse.
Go to 'Eclipse >Preferences' (Mac) or 'File > Preferences'(Windows) and then go to 'general > editors > file associations'.

click the add button on the left and enter '*.php' with out the quotes.

After you hit ok you will see a list of editors below. Click on 'PHP Editor' and then click the default button on the right. And then click ok.

Step 7: Configuring Remote System Explorer
First thing you need to do is add the Remote System Explorer perspective to your eclipse workspace.
Go to 'Window > Open Perspective > Other'. now look for Remote System Explorer and add that.

Now you will have a new tab in your Eclipse workspace. By defualt you can browse and edit local files on your hard drive with RSE.

Now the fun part setting up a new conennection.Clcik the little down arrow in the 'Remote System' tab and select 'New Connection'

The next screen shows you all diffecent types of connection. I am going to walk through setting up a ssh connection. So on the next screen select 'SSh Only' and select Next.

the next screen you will need to enter in your host. I am not going to show a picture of this step.
Now you have a new connection in your 'Remote System' tab if you unfold it you will see 'My home' and 'Root'. By default RSE gives you these two file filters to choose from.

If you want to add another filter you want to right click on 'Sftp Files' and go to 'New > Filter'.

Next you will enter in the file location you would like to start from, like /home/test. Select next, give the filter and name and click ok.
Step 8: Fixing PHP autocomplete with Remote System Explorer
The last step is fixing the php autocomplete feature. To do this you are going to have edit a hidden file in your workspace folder. But first we are going to enable hidden files on RSE. Go to 'Eclipse > Preferences' (Mac) or 'File > Preferences' (Windows) and then unfold 'Remote Systems > Files'.

Check 'Show Hidden Files' and click ok.
Now we are going to use RSE to edit an eclipse RSE .project file. So in your 'Remote System' tab open up your local files and navigate to you workspace folder. Look for a folder called 'RemoteSystemsTempFiles' and open that. Now you are going to edit the '.project' file. Open up that file.
You are going to add two line in between the <natures> tag, those lines are
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> <nature>org.eclipse.php.core.PHPNature</nature>


patrick's tweets
- Recent Project: Converting the BMJ (British Medical Journal) to Drupal http://t.co/6sTLhMFZ — 1 year 8 hours ago
- Climate Change http://t.co/wuPwyIan — 1 year 21 weeks ago
Thank you very much
Anonymous — Wed, 08/17/2011 - 06:26Thanks!
Anonymous — Tue, 08/23/2011 - 05:56aaa
Anonymous — Sat, 09/03/2011 - 14:12Didn't work for me. Eclipse
Anonymous — Wed, 09/14/2011 - 04:19Can you be more descriptive,
patrick — Wed, 09/14/2011 - 10:43Can you be more descriptive, what doesnt work?
Thanks
Anonymous — Tue, 09/20/2011 - 02:06Another Thanks
Anonymous — Fri, 09/23/2011 - 11:52I have been looking for a post like this for weeks
Anonymous — Mon, 10/17/2011 - 04:57update sites empty
Anonymous — Tue, 10/18/2011 - 08:05i found
Anonymous — Tue, 10/18/2011 - 08:19PDT version
Anonymous — Fri, 10/28/2011 - 01:49yes I am using pdt version
patrick — Sat, 10/29/2011 - 12:18Thank you!
Anonymous — Tue, 11/01/2011 - 08:02Fantastic!
Anonymous — Thu, 11/03/2011 - 01:52drupal_add_js()is missing from the list :)Thank you!
Anonymous — Fri, 11/04/2011 - 13:58Great!
Anonymous — Sat, 11/05/2011 - 12:44much appreciation
Anonymous — Fri, 11/25/2011 - 00:19Thanks, but it would be
Anonymous — Mon, 12/12/2011 - 09:22That is your own mistake, RSE
Anonymous — Mon, 12/12/2011 - 12:45what about .php5 Extention?
Anonymous — Mon, 12/12/2011 - 11:39Just go to ecliplse
Anonymous — Mon, 12/12/2011 - 12:47Drupal PDT add-on feedback
Anonymous — Thu, 12/15/2011 - 16:35Default editor / Encoding
Anonymous — Mon, 12/19/2011 - 09:22Default editor / Encoding
Anonymous — Mon, 04/02/2012 - 17:53To be honest I have not been
patrick — Mon, 12/19/2011 - 09:27Default editor / Encoding
Anonymous — Mon, 12/19/2011 - 09:27Missing ability to navigate between classes
Anonymous — Wed, 12/21/2011 - 03:57Resolved : Missing ability to navigate between classes
Anonymous — Thu, 12/22/2011 - 02:27how do you debug the remote?
Anonymous — Tue, 12/27/2011 - 10:14Thank You
Anonymous — Wed, 01/04/2012 - 01:59Code completion in RSE
Anonymous — Fri, 01/06/2012 - 08:30Does not work on my version
Anonymous — Fri, 01/06/2012 - 12:20I use galieo, I have never
patrick — Tue, 05/08/2012 - 13:53It works beautifully!!
Anonymous — Sat, 01/28/2012 - 05:42Thank you
Anonymous — Thu, 02/02/2012 - 11:31Seriously - Thank You
Anonymous — Sat, 02/04/2012 - 16:23For Getting host-name under ssh (In Mac)
Anonymous — Sun, 02/05/2012 - 13:45very helpful
Anonymous — Mon, 02/06/2012 - 06:15Helped Me so Much
Anonymous — Thu, 02/09/2012 - 07:38Tremendous Time Saver
Anonymous — Sun, 02/12/2012 - 17:10Shows Pending when click on work with -All availabe sites
Anonymous — Wed, 02/15/2012 - 01:46JDK & JRE
Anonymous — Wed, 02/29/2012 - 13:49Thanks. Worked like a charm!
Anonymous — Wed, 02/22/2012 - 16:50Thanks
Anonymous — Wed, 02/29/2012 - 16:09MY GOD, thank you!
Anonymous — Fri, 03/02/2012 - 05:59Thank you!
Anonymous — Thu, 03/08/2012 - 13:50Reply to comment | Patrick J Waters
Anonymous — Sun, 07/08/2012 - 09:20Nice explanation
Anonymous — Tue, 04/03/2012 - 23:33thank you
Anonymous — Mon, 04/23/2012 - 04:26THANKS!!!
Anonymous — Tue, 05/01/2012 - 13:45Post new comment