Installing Eclipse for PHP Developers

From Cosmin's Wiki

Jump to: navigation, search

Home > Linux Desktop tips > Installing Eclipse for PHP Developers



This article describes how to install PDT 2.1 (Php Development Tools) All-in-One in Ubuntu 9.04. Should you go with the tratidional install of Eclipse, you will find that the official repositories will offer you Eclipse 3.2.2, while the latest version of Eclipse is 3.4.1. Moreover, this method will get you automatically all the extensions you need for developing php applications.

Contents


Prerequisites

You will need to check that you have sun-java6-jdk installed on your computer. If you don't just go to the terminal as root and:

> aptitude install sun-java6-jdk


Installing PDT

Download the All-In-One Linux x86/GTK 2 32-bit or All-In-One Linux x86/GTK 2 64-bit packages, depending on the configuration of your machine. You would want to get the packages from The Eclipse Website. Assuming you have downloaded the eclipse-php-galileo-linux-gtk.tar.gz file to your home directory, now you'll have to unpack it:

> tar xzfv eclipse-php-galileo-linux-gtk.tar.gz

This will create an eclipse directory under your home directory. To run eclipse, you just type

> ~/eclipse/eclipse

The first time you start eclipse, it will ask you to run some commands as root. Just do that and everything will be fine.


Create executable and menu item

Now, as we're in a desktop environment, we would like to run Eclipse from the Applications/Programming/Eclipse menu. It's quite easy to do this. First, move the eclipse folder under /opt, eventually adding the version number:

> mv /home/cosmin/eclipse /opt/eclipse-3.4.1

Create now a new executable file under /usr/local/bin/eclipse with the following content:

#!/bin/bash
export JAVA_HOME="/usr/lib/jvm/java-6-sun"
export ECLIPSE_HOME="/opt/eclipse-3.4.1"
 
$ECLIPSE_HOME/eclipse

and make it executable:

> chmod 755 /usr/local/bin/eclipse

The last thing to do now is to create the menu item. For this, create a new file /usr/share/applications/eclipse.desktop with the following content:

[Desktop Entry]
Encoding=UTF-8
Name=Eclipse
Comment=Eclipse IDE
Exec=eclipse
Icon=eclipse
Terminal=false
Type=Application
Categories=GNOME;Application;Development;
StartupNotify=true

Now you can start Eclipse from the Applications/Programming/Eclipse menu.