Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

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

(Installing Apache 2.0 and PHP 5.0 on Ubuntu Linux)
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
This document is a work in progress.
+
We use Eclipse to edit our content. In order to test our content, we have two choices: (1) push your work to git.eclipse.org 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 Git server and copying to the web server, your 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).
  
The runtime environment for [http://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.
+
Note that you can also [[Git/Editing your Eclipse project Website using Orion|use Orion to Edit your project website]].
  
==Phoenix Test Runtime Environment for Windows XP Setup==
+
=Setting up Eclipse=
+
==Installing PHP Development Tools (PDT)==
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://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===
+
You can use the text editor to edit your PHP files, but the [http://www.eclipse.org/pdt PHP Development Tools] make the experience much better.  Use the "Install new software..." option in Eclipse 3.5+ to add the PHP Development Tools to your configuration.
  
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. When prompted for the "Network domain", specify "phoenix.eclipse.org". 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.
+
==Workspace==
  
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".
+
Create a new project name 'www' in your workspace (if you have installed the PDT, then make this a PHP project).
 +
 
 +
==Create a clone of your Website directory==
 +
 
 +
The first thing that you need to know if the URL of the Git repository that you'd like to work with. In Git parlance, we need to make a clone of that repository on the Orion server. You will make edits in the local copy on Orion and then "push" your changes (commits) back to the Eclipse Git server.
 +
 
 +
Your project's website directory will be located under [http://git.eclipse.org/c/www.eclipse.org www.eclipse.org] on the Git server. The website for your project will be in a directory named <project-short-name>.git (e.g. [http://git.eclipse.org/c/www.eclipse.org/orion.git/ orion.git]). Click on your project repository, scroll down to the bottom and copy the "ssh://..." URL listed under "Clone" (e.g. ssh://git.eclipse.org/gitroot/www.eclipse.org/orion.git).
 +
 
 +
Use eGit to clone the repository into a ~/git/www (or an equivalent directory).
 +
 
 +
''If you intend to test locally, also clone the 'eclipse.org-common' directory into the ~/git/www directory (note that you can do this later if you change your mind).''
 +
 
 +
You should now be able to edit the files on your website, and push (commit) them to test them live.
 +
 
 +
=Creating a Server=
 +
 
 +
Read on if you'd like to set up a local test server (that will allow you to test locally before you commit to the live server).
 +
 
 +
''FWIW, if you are new project, chances are that breaking your project's website for a few minutes is not a big deal. That is, you may be able to defer setting up a test server.''
 +
 
 +
Most Linux distributions provide the means to install Apache 2.0+ and PHP 5.0+. If you know what you're doing, you can also install these pieces on other platforms, such as Windows. However, distributions such as XAMPP make this much easier.
 +
 
 +
==Installing XAMPP==
 +
 
 +
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.
 +
 
 +
The first step is to actually obtain XAMPP from the [http://www.apachefriends.org/en/xampp.html download web site]. 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.
 +
 
 +
===Ensure short PHP tags are enabled===
 +
 
 +
in your php.ini file, ensure short tags are enable. This can be set in a global /etc/php.ini or a site specific one
  
===Configuration===
 
 
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:\phoenix_runtime\apache\conf\http.conf</code>). Scroll to the
 
bottom and locate the following section:
 
 
 
<pre>
 
<pre>
&lt;VirtualHost local.phoenix.eclipse.org:80&gt;
+
short_open_tag = On
DocumentRoot c:/eclipse311/workspace/www
+
</pre>
ServerName local.phoenix.eclipse.org:80
+
ErrorLog logs/phoenix
+
CustomLog logs/phoenix common
+
&lt;/VirtualHost&gt;</pre>
+
+
Change the &quot;DocumentRoot&quot; entry to point to the location
+
of your www directory. The above entry assumes that the workspace is
+
located in <code>c:/eclipse311/workspace</code>. If you used the
+
default workspace when you first started Eclipse, you'd change this
+
value to <code>c:\Documents and Settings\Wayne Beaton\workspace\www</code>
+
(that is, assuming your name is &quot;Wayne Beaton&quot;.
+
+
It may look something like the following:
+
<pre>
+
&lt;VirtualHost local.phoenix.eclipse.org:80&gt;
+
DocumentRoot c:\Documents and Settings\Wayne Beaton\workspace\www
+
  
ServerName local.phoenix.eclipse.org:80
+
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.
ErrorLog logs/phoenix
+
 
CustomLog logs/phoenix common
+
===Setup a Virtual Host===
&lt;/VirtualHost&gt;</pre>
+
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).
+
 
Save the file.
+
Open the "httpd.conf" file. Scroll to the bottom and add the following section:
+
 
<strong>Step 2:</strong> Configure the host. The previous setting
+
<pre>&lt;Directory "/home/[userid]/git/www"&gt;
configures a virtual host on your workstation named
+
AllowOverride All
&quot;local.phoenix.eclipse.org&quot;; in this step, you need to configure
+
Order allow,deny
your workstation to know about the host. Open your hosts file using your
+
Allow from all
favourite text editor. This file is likely located at  
+
&lt;/Directory&gt;
<code>c:\windows\system32\drivers\etc\hosts</code>. Add the following
+
 
 +
&lt;VirtualHost local.eclipse.org:80&gt;
 +
    DocumentRoot /home/[userid]/git/www
 +
    ServerName local.eclipse.org:80
 +
    ErrorLog logs/phoenix
 +
    CustomLog logs/phoenix common
 +
&lt;/VirtualHost&gt;</pre>
 +
 
 +
Replace "/home/[userid]/git/www" with the path to your 'www' directory (we've suggested ~/git/www which translates to something like "/home/[userid]/git/www"). 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 <code>c:\windows\system32\drivers\etc\hosts</code>. Add the following
 
line to this file:
 
line to this file:
 
 
<pre>
+
<pre>127.0.0.1 local.eclipse.org</pre>
 +
 
 +
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.
 +
 
 +
==File/Directory Permissions==
 +
You may have to modify directory permissions (depending on operating system and configuration) to make this work. On Linux systems, the entire directory chain leading to your 'www' directory need to be marked executable by the web user. On Windows, this should just work (score one for Windows "security").
 +
 
 +
==Installing Apache 2.0 and PHP 5.0 on Ubuntu Linux==
 +
 
 +
<blockquote>Note that you will need root access to make all of these changes.</blockquote>
 +
 
 +
Use the package manager to install Apache 2.0 and PHP 5.0.
 +
 
 +
Create the file /etc/apache2/sites-available/local.eclipse.org with the following content:
 +
 
 +
<pre><nowiki>NameVirtualHost *:80
 +
 
 +
<VirtualHost *:80>
 +
    ServerName local.eclipse.org
 +
    DocumentRoot /home/[userid]/git/www
 +
    ErrorLog /var/log/apache2/local.eclipse.org.log
 +
 
 +
<Directory /home/[userid]/git/www>
 +
    AllowOverride All
 +
    Order Allow,Deny
 +
    Allow from ALL
 +
</Directory>
 +
</VirtualHost></nowiki></pre>
 +
 
 +
Replace "/home/[userid]/git/www" (2 occurrences!) 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".
 +
 
 +
Add the following line to your /etc/hosts file:
 +
 
 +
<pre>127.0.1.1 local.eclipse.org</pre>
 +
 
 +
Execute the following:
 +
 
 +
<pre>a2ensite local.eclipse.org
 +
/etc/init.d/apache2 restart</pre>
 +
 
 +
And you should be in business.
  
127.0.0.1 local.phoenix.eclipse.org
+
Note that you may have to grant read access of your workspace files to the webserver.
</pre>
+
+
Save the file.
+
+
This line tells Windows that when a browser makes a request to
+
[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>apache_start.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.
+

Latest revision as of 15:01, 1 March 2013

We use Eclipse to edit our content. In order to test our content, we have two choices: (1) push your work to git.eclipse.org 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 Git server and copying to the web server, your 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).

Note that you can also use Orion to Edit your project website.

Setting up Eclipse

Installing PHP Development Tools (PDT)

You can use the text editor to edit your PHP files, but the PHP Development Tools make the experience much better. Use the "Install new software..." option in Eclipse 3.5+ to add the PHP Development Tools to your configuration.

Workspace

Create a new project name 'www' in your workspace (if you have installed the PDT, then make this a PHP project).

Create a clone of your Website directory

The first thing that you need to know if the URL of the Git repository that you'd like to work with. In Git parlance, we need to make a clone of that repository on the Orion server. You will make edits in the local copy on Orion and then "push" your changes (commits) back to the Eclipse Git server.

Your project's website directory will be located under www.eclipse.org on the Git server. The website for your project will be in a directory named <project-short-name>.git (e.g. orion.git). Click on your project repository, scroll down to the bottom and copy the "ssh://..." URL listed under "Clone" (e.g. ssh://git.eclipse.org/gitroot/www.eclipse.org/orion.git).

Use eGit to clone the repository into a ~/git/www (or an equivalent directory).

If you intend to test locally, also clone the 'eclipse.org-common' directory into the ~/git/www directory (note that you can do this later if you change your mind).

You should now be able to edit the files on your website, and push (commit) them to test them live.

Creating a Server

Read on if you'd like to set up a local test server (that will allow you to test locally before you commit to the live server).

FWIW, if you are new project, chances are that breaking your project's website for a few minutes is not a big deal. That is, you may be able to defer setting up a test server.

Most Linux distributions provide the means to install Apache 2.0+ and PHP 5.0+. If you know what you're doing, you can also install these pieces on other platforms, such as Windows. However, distributions such as XAMPP make this much easier.

Installing XAMPP

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.

The first step is to actually obtain XAMPP from the download web site. 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.

Ensure short PHP tags are enabled

in your php.ini file, ensure short tags are enable. This can be set in a global /etc/php.ini or a site specific one

short_open_tag = On

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 "/home/[userid]/git/www">
	AllowOverride All
	Order allow,deny
	Allow from all
</Directory>

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

Replace "/home/[userid]/git/www" with the path to your 'www' directory (we've suggested ~/git/www which translates to something like "/home/[userid]/git/www"). 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.

File/Directory Permissions

You may have to modify directory permissions (depending on operating system and configuration) to make this work. On Linux systems, the entire directory chain leading to your 'www' directory need to be marked executable by the web user. On Windows, this should just work (score one for Windows "security").

Installing Apache 2.0 and PHP 5.0 on Ubuntu Linux

Note that you will need root access to make all of these changes.

Use the package manager to install Apache 2.0 and PHP 5.0.

Create the file /etc/apache2/sites-available/local.eclipse.org with the following content:

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName local.eclipse.org
    DocumentRoot /home/[userid]/git/www
    ErrorLog	/var/log/apache2/local.eclipse.org.log

<Directory /home/[userid]/git/www>
    AllowOverride All
    Order Allow,Deny
    Allow from ALL
</Directory>
</VirtualHost>

Replace "/home/[userid]/git/www" (2 occurrences!) 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".

Add the following line to your /etc/hosts file:

127.0.1.1	local.eclipse.org

Execute the following:

a2ensite local.eclipse.org
/etc/init.d/apache2 restart

And you should be in business.

Note that you may have to grant read access of your workspace files to the webserver.

Back to the top