Jump to: navigation, search

Difference between revisions of "Configuring Eclipse to Edit your eclipse.org Website"

m
Line 1: Line 1:
 
This document is a work in progress.
 
This document is a work in progress.
  
The runtime environment for http://www.eclipse.org runs Apache HTTP Server and PHP 4.3.4. Previous instructions have detailed how to configure [http://www.apachefriends.org/en/xampp.html XAMPP] for use as a unit test environment for Phoenix. Unfortunately, XAMPP runs PHP 5.0 and there are significant differences between PHP versions 4.3.4 and 5.0 which make reliable testing impossible.
+
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 [http://www.apachefriends.org/en/xampp.html XAMPP] as your unit test environment.
  
==Phoenix Test Runtime Environment for Windows XP Setup==
+
Just what the heck are we talking about? Good question.
+
This document takes you through the steps that you need to follow
+
to configure your workstation to run an Apache runtime environment
+
similar to the environment running the http://www.eclipse.org website. This environment
+
is similar to the production environment but is not exact. It includes
+
a minimally configured Apache web server along with PHP 4.3.4. This
+
environment does <em>not</em> include MySQL or any other services.
+
  
===Download and Installation===
+
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 <b>before</b> 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).
  
Download Apache HTTP Server 2.2.2 (current version at the time of this writing). You can find it [http://httpd.apache.org/download.cgi here]. Follow the provided instructions to install the software. On Windows, you will be asked if you want to install Apache as a service. If you do so, it will start whenever your machine is started. It is not necessary to install Apache as a service.
+
==Installing XAMPP==
  
All the steps in this document assume that Apache HTTP Server is installed in the default location. On Windows this is "C:\Program Files\Apache Software Foundation\Apache2.2".
+
The first step is to actually obtain XAMPP from the [http://www.apachefriends.org/en/xampp.html 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.
  
Download PHP 4.3.4. You can find it [http://www.php.net/releases.php here]. Follow the provided instructions to install the software. These instructions assume that it is installed in "C:\php-4.3.4". Be sure to select the Apache HTTP Server when prompted during installation. Assuming that the installer software has not been updated, you will have to manually configure Apache HTTP Server to find PHP. These instructions are written to the PHP directory during the installation process.
+
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.
  
Effectively, this should amount to including the following lines in your apache.conf file:
+
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.
<pre>LoadModule php4_module "/php-4.3.4/php4apache2.dll"
+
PHPIniDir "/php-4.3.4"
+
AddType application/x-httpd-php .php .php4 .php3 .phtml</pre>
+
  
===Configuration===
+
===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).  
This document assumes that you have a project named &quot;www&quot;
+
containing the website contents in your Eclipse workspace.
+
+
<strong>Step 1:</strong> Configure Apache. Open the
+
&quot;http.conf&quot; file (located in
+
<code>C:\Program Files\Apache Software Foundation\Apache2.2\conf\http.conf</code>). Scroll to the
+
bottom and add the following section:
+
  
<pre>&lt;VirtualHost local.phoenix.eclipse.org:80&gt;
+
Open the "httpd.conf" file. Scroll to the bottom and add the following section:
 +
 
 +
<pre>&lt;Directory "[workspace_location]\www">&gt;
 +
AllowOverride All
 +
Order allow,deny
 +
Allow from all
 +
&lt;/Directory&gt;
 +
 
 +
&lt;VirtualHost local.eclipse.org:80&gt;
 
     DocumentRoot [workspace_location]\www
 
     DocumentRoot [workspace_location]\www
     ServerName local.phoenix.eclipse.org:80
+
     ServerName local.eclipse.org:80
 
     ErrorLog logs/phoenix
 
     ErrorLog logs/phoenix
 
     CustomLog logs/phoenix common
 
     CustomLog logs/phoenix common
 
&lt;/VirtualHost&gt;</pre>
 
&lt;/VirtualHost&gt;</pre>
  
Be sure to replace [workspace_location] with the location of your Eclipse workspace. This setting assumes that you will keep all your Phoenix code in a project named "www" and directs the Apache HTTP server to find content there.
+
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".
  
Save the file.
+
Open your hosts file using your
+
<strong>Step 2:</strong> Configure the host. The previous setting
+
configures a virtual host on your workstation named
+
&quot;local.phoenix.eclipse.org&quot;; in this step, you need to configure
+
your workstation to know about the host. Open your hosts file using your
+
 
favourite text editor. On Windows, this file is likely located at  
 
favourite text editor. On Windows, this file is likely located at  
 
<code>c:\windows\system32\drivers\etc\hosts</code>. Add the following
 
<code>c:\windows\system32\drivers\etc\hosts</code>. Add the following
 
line to this file:
 
line to this file:
 
 
<pre>127.0.0.1 local.phoenix.eclipse.org</pre>
+
<pre>127.0.0.1 local.eclipse.org</pre>
+
 
Save the file.
+
This adds the name <code>local.eclipse.org</code> 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 <code>http://local.phoenix.eclipse.org</code>, 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.
This line tells Windows that when a browser makes a request to
+
http://local.phoenix.eclipse.org, 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.
+
+
<strong>Step 3:</strong> Start Apache. You can start Apache from
+
the command line using the <code>httpd.exe</code>. Stop Apache
+
by typing Ctrl-C at the command prompt that started Apache. You can
+
also install Apache as a Windows service which will make it start
+
automatically when the workstation starts up.
+

Revision as of 22:25, 3 October 2006

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

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
</Directory>

<VirtualHost local.eclipse.org:80>
    DocumentRoot [workspace_location]\www
    ServerName local.eclipse.org:80
    ErrorLog logs/phoenix
    CustomLog logs/phoenix common
</VirtualHost>

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:

127.0.0.1	local.eclipse.org

This adds the name local.eclipse.org 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 http://local.phoenix.eclipse.org, 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.