Thursday, February 25, 2010

Eclipse PHP and Remote Editing

Original Post: September 4th, 2008
 
Eclipse PDT (former PHP IDE) is a free alternative to expensive PHP IDEs.  It comes loaded with a lot of features and a large plugin database.   One of the most usefull plugins is the Remote System Explorer (RSE). The Remote System Explorer (RSE) allows you to work remotely over the internet.  For this article, I explain how to mount a remote PHP project over SSH.
Eclipse PDT Installation
The easies way to install Eclipse PDT is to download the latest all-in-one version from http://www.eclipse.org/pdt/.  Once on the page:
  • Click on the Download link.
  • Find the latest release (stable release is recommended).
  • Look for All-in-one option and click on the link corresponding to your platform (Linux, Max, Windows).
  • Once downloaded, Uncompress the file and open the eclipse executable
Installing the Remote System Explorer (RSE)
Once your eclipse platform is open
  • Click on the Help menu.
  • Navigate your way to Software Updates and click on “Find and Install…”.
  • The “Feature Updates” window will open, then Select “Search for new features to install” and click on Next.
  • Check the the “Europa Discovery Site” and click on Finish.
  • On the “Update Site Mirrors” window, select a mirror or just click OK.
  • On the “Search Results” window, expand the “Europa Discovery Site”.
  • Check the “Remote Access and Device Development” box, then click on the “Select Required” button.
  • Click Next.
  • Accept the terms and click on Next.
  • Click on Finish. (wait for the software to download)
  • When the “Verification” window pops up, click on “Install All”.
  • After installation is complete, say “Yes” to restart the eclipse.
Open the Remote System Explorer Perspective
  • Click on the Window menu.
  • Navigate to “Open Perspective” and click on “Other…”.
  • Select “Remote System Explorer” and and click OK.
  • Click on the “Define a connection to remote system” icon.Define a connection to remote system
  • Select the “SSH Only” as the System Type, and click on Next.Select Connection Type
  • Type the Host Name of the SSH Server and click on Finish.Type Host Name
  • Navigate your way to the folder that has your PHP code.  While doing this, Eclipse will ask you for your login credentials. Type your SSH Login and Password and click OK.ssh navigationeclipse ssh login credentials
  • Once you find the folder you are looking for, Right-Click on it, and click on “Create Remote Project”. Depending on the size of the project this could take a while.
  • Now you should be able to open your PHP prospective by clicking on the Window -> Open Prospective -> “Other …” menu.  Then slect PHP from the list and click OK.
This is it, You should now be able to work remotely as if it where on the local machine.
Note:  If your PDT Eclipse doesn’t recognize the project as a PHP Project, then you must manually edit the .project file on the remote server and add the following code:
Between the <buildSpec> tags add:

<buildCommand>
<name>org.eclipse.php.core.PhpIncrementalProjectBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.php.core.ValidationManagerWrapper</name>
<arguments>
</arguments>
</buildCommand>

and between the <nature> Tags add:

<nature>org.eclipse.php.core.PHPNature</nature>

Then Restart Eclipse.

Enjoy.

No comments:

Post a Comment