Debianhelp.co.uk

Submit Article

 Install PHP-Eclipse for Eclipse 3.1 on Debian Sarge

What is Eclipse ?

Eclipse is an open source community whose projects are focused on providing an extensible development platform and application frameworks for building software.

Eclipse Documentation

http://www.eclipse.org/documentation/main.html

Download Eclipse

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

Eclipse Articles

http://www.eclipse.org/articles/

This article helps installing Eclipse 3.1 and the PHPEclipse plugin on a Debian Sarge install. This means installing the basic software, installing the PHP plugin into it, creating a new project and testing the debug functions.

Eclipse 3.1

There is no (official) package for Eclipse 3.1 on Debian Sarge, so this install procedure is based on the binary software available for Linux x86 here.

Download the software and uncompress it (it uncompresses in a directory named eclipse, so you can uncompress it wherever you want to) and move into the eclipse directory.

$ tar zxvc eclipse-SDK-3.1.1-linux-gtk.tar.gz

$ cd eclipse

Quick start Eclipse by launching the eclipse executable

$ ./eclipse

Decide which directory will be your workspace. The workspace directory is where Eclipse files are kept, not where your source files are kept, so don't use the sources directory as this will conflict with projects you might create later.

Select "Workbench" (unless you want to learn more about anything) in the intro screen.

You are now inside the IDE.

PHP Plugin

To get an open-source free sofware PHP plugin, go to the SourceForge page for the plugin and download the plugin for Eclipse 3.1 stream (not official by the time of writing).

Once downloaded, unzip the file in the newly-created eclipse directory, they should be written into the plugins and features directory directly.

$ unzip phpeclipse-1.1.6-unofficial.zip

Now start Eclipse again

$ ./eclipse

Inside Eclipse,

use File > Import > External Features
select the location (normally the Eclipse directory) and click Next
click "Select All"
click "Finish"
Then import plugins in the same way
use File > Import > External Plug-ins and Fragments
Click "Next"
Click "Add All" (or only select the ones coming from sourceforge if you want to restrict to the minimum)
Click "Finish"
Create a PHP Project
use File > New > Project...
Click "PHP"
select "PHP Project" and click "Next"
give a project name
uncheck the box (if your source code directory already exists) and enter the path to your sources for this project
click "Finish"
You now have a new project appearing in your left navigation bar.

Setting up PHP interpreter

the plugin expects to find the PHP interpreter as /apache/php/php. You don't want that as on a Debian machine, it is located at /usr/bin/php (or php4). To change it, use the Run > Debug menu
Click on "PHP Application"
Click "New"
Give a name ("My interpreter"?)
Select the file you want to debug in this case (just select one PHP file from your new project)
Select the "Environment" tab
Select the "Interpreter" tab
Browse to select /usr/bin/php4
Click "Debug"
That's it, you have debugged your first PHP script with Eclipse.