Introduction

Eclipse is a free IDE used for software development. It’s not necessarily the most popular one, but it’s free and easy to use, plus it supports many languages and is open source and easy to customize. There is a lot of support available, so if you have problems it’s very easy to find out and fix the problems.

Symfony is a popular PHP web framework. I have personally evaluated it against a few other frameworks and find it to be one of the best and easiest to use out there.

This blog is about setting up your Eclipse IDE environment to work with Symfony.

Remote Systems Explorer

In my typical environment, Symfony is installed on a server (RHEL or CentOS) and my Eclipse IDE is on a remote client. I normally use Windows client, but the usage of Eclipse on Linux should be similar.

In Eclipse, select “Window > Show View > Other…”; then expand the “Remote Systems” folder and click on “Remote Systems”. Normally, I’ll move this window to the left pane of Eclipse. Then to add a SSH connection to your server that hosts Symfony, perform the following steps:

  1. Right-click in the Remote Systems pane and select “New Connection…”.
  2. Select “SSH Only” and click “Next >”.
  3. Enter in the “Host name”, which can be a DNS name or an IP address.
  4. Enter a “Connection name”. This can be whatever you like, and make it a suitable name to identify the host easily to you.
  5. Then at this point you can click the “Finish” button to complete adding the connection.

I suggest then creating a sftp filter for just the web folder, instead of you having to expand each of the folders every time you need to re-establish a connection to the remote server. In these steps I’ll presume you have Apache (httpd) installed, which has a specific path under the var folder.

  1. Right-click on “Sftp Files” and select “New > Filter…”.
  2. In the File Filter, enter the folder path as “/var/www/html” (path for Apache), then click “Next >”.
  3. Enter the “Filter name” as “WEB Root” (or whatever you prefer to call it), then click “Finish”.
  4. Then click on the “WEB Root” filter, and notice it prompts you to authenticate.
  5. Enter your username (User ID) and password on the remote host, and make sure the “Save password” button is checked.
  6. The filter expands to show you all directories under the WEB Root folder.

One point about the above connection and sftp filter: If you are not part of the root user group, or you are not the root user on the remote server, you will not be able to save files within the WEB Root folder using Eclipse. The easy workaround for this is to create a Development Environment described below.

Development Environment

As mentioned above, if you not the root user on the remote server, and for example you normally have to use “sudo” to save (or copy) files in the WEB Root folder, you will not be able to save files use Remote System Explorer in Eclipse. A good developer will always test their code in a Development Environment first to make sure everything works properly before deploying to the Production Environment, and this is what I will describe here.

Typically at Taft College, we use RHEL for our Production servers, and I will use CentOS as a Development Environment, since it is based on RHEL (although not quite similar). I setup CentOS in VirtualBox on my desktop, and I install everything as the root user. Then I setup Eclipse to connect as the root user, and I fully test my code on this test virtual machine. Once I’m ready to deploy my code, I use WinSCP to copy and transfer from my Development Environment to a sub folder in my HOME directory on the Production RHEL server. Then I use PuTTY to login to the Production server and use sudo to copy over the new or changed files to the Symfony sub directories. This whole process can be done quite quickly, and once you’ve done it a few times, it seems so easy to do.

 

Advertisement