Skip to main content
Jump to: navigation, search

Configuring Eclipse to Edit your Website

Revision as of 15:28, 15 November 2006 by (Talk | contribs)

This document is a work in progress.

In anticipation of the forthcoming upgrade of the Eclipse Foundation Servers, it is recommended that any new configurations of a unit test environment use PHP 5.0. There are some differences between the version currently supported (4.3.4 as of October 2006) and the future version, but most of the pages on the site should work on both versions. To that end, we are now recommending that you install XAMPP as your unit test environment.

Just what the heck are we talking about? Good question.

We use Eclipse to edit our content. In order to test our content, we have two choices: (1) commit the work to CVS which will (in a matter of minutes) copy the files to the live web server where you can test; or (2) setup a local unit test environment. The benefit of (1) is that it takes very little effort. Unfortunately, by committing to the CVS server and copying to the web server, you work is made public; in effect, you are testing your work on the live web server where everybody can see it. As long as everything goes well, this is fine. The second option is to set up a local unit test environment where you can actually test your work before you make it available to the adoring masses. Intuitively, the second option is safer, and tends to work a lot better when you're disconnected (for whatever reason).

Installing XAMPP

You need to follow the steps in this section if you intend to setup a local unit test environment. If you instead choose to be evil and just test against the live server, you can skip this section.

The first step is to actually obtain XAMPP from the download web site. XAMPP is a distribution of Apache HTTP Server that also includes PHP 5.0.x, MySQL and other useful software. As of October 2006, version 1.5.4 seems to contain the right versions of the parts we need. Depending on how paranoid you are, you can download a one-step installer for some platforms, or you can download the ZIP file and unpack it yourself. The one-step installer variant does fun things like install the web server as a service on Windows (and probably messes around with your registry). Decide for yourself how paranoid you are about that sort of thing.

In these instructions, we're going to set up Apache so that it runs files directly out of your workspace. This makes testing really easy since you don't have to copy anything anywhere to make it work. However, the following configuration instructions are a little twisted for good reason: if you're not careful, open some security holes on your workstation. These instructions will help you configure Apache so that only you can access the contents of your workspace from your workstation.

To configure Apache, you're going to have to edit the "http.conf" file. This file is located in the "apache" directory in the XAMPP installation.

Setup a Virtual Host

In this section, you'll set up a virtual host for Apache. This virtual host will be known only to your workstation (and so will only work when used from your workstation).

Open the "httpd.conf" file. Scroll to the bottom and add the following section:

<Directory "[workspace_location]\www">
	AllowOverride All
	Order allow,deny
	Allow from all

    DocumentRoot [workspace_location]\www
    ErrorLog logs/phoenix
    CustomLog logs/phoenix common

Replace [workspace_location] with the path to your Eclipse workspace. This assumes that you will store the web content in a directory named "www" (this is what the directory is called on the CVS server). If you have opted to use a different name, use it instead of "www".

Open your hosts file using your favourite text editor. On Windows, this file is likely located at c:\windows\system32\drivers\etc\hosts. Add the following line to this file:

This adds the name to the list of names your computer knows about. Unless this name is propogated to some shared DNS and mapped to your machine's IP address, nobody else will be able to use this address to access your computer. This line tells Windows that when a browser makes a request to, that the local machine will handle it. Your configuration of Apache has ensured that all requests coming into that address on the default port (80) will be handled by Apache using documents found in your workspace.

Configuring XAMPP

Some of the default configuration in XAMPP is different from that running on the production server.

Magic Quotes

Magic Quotes automatically escapes incoming data to the PHP script. Essentially, if data is posted with single or double quotes they are escaped if this feature is turned on ("It's time to go" is transated in to "It\'s time to go"). By default, XAMPP turns this feature on; on our server, it's off.

Change this behaviour in the php.ini file (the one found in .\xampp\apache\bin) by changing the line:

; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = Off

Installing PHPEclipse

Coming soon. Honest.

Back to the top