How To…Deploy to Apache


“How can I deploy the WebTier to Apache?”

Deploying the WebTier on Apache

The following is a supplement to the Server Edition Developer’s Guide, installed to …RBServer\Developer’s Guide\RBServer.pdf.  This document provides a step-by-step tutorial which shows how to implement the web tier as part of an Apache Shared Module. The web tier acts as the second tier in a three tier solution provided by the Server Edition. The first tier is a report server application; the third tier is a web browser. For more information regarding the full three-tiered solution, see the Developer’s Guide.



Apache is a freely available, open source web server that is estimated to be hosting 70% of the world’s web sites. Apache was initially created to run on Linux and then ported to Windows. For more information on Apache please see

Apache Shared Modules

Apache Shared Modules are the preferred solution for implementing high performance web applications hosted by the Apache web server. They are essentially Apache’s proprietary way of implementing the ISAPI concept.

Delphi and Apache Compatibility

The Delphi 7 web server application wizard includes the ability to create Apache 2 shared modules. Starting with Delphi 2005, Borland dropped the Apache option from the wizard, though the applicable units required to compile Apache shared module application are still included. Presumably Borland’s reason for dropping the Apache option is due to frustration over Apache interface changes being introduced with each Apache release (thus creating compatibility issues).

We used Delphi 7 to create this example and we recommend using it as a starting point – particularly if you are using Delphi 2005 or later.

Depending upon which versions of Delphi and Apache you are using, it may be necessary to modify the Delphi source code so that it can produce Apache shared modules that are compatible with your Apache installation. For more information please see the following article.

Getting Started – a simple ‘Hello World’ application

As a first step, we strongly recommend reading the following article and creating a trivial Hello World application as thearticle describes.

Deploying the WebTier as an Apache Shared Module

Configure Apache for the WebTier
    1. Create the ReportBuilder web cache directory:C:\Program Files\Apache Group\Apache2\rbCache
    2. Open the Apache configuration file (use Notepad or any text editor).C:\Program Files\Apache Group\Apache2\Conf \httpd.conf
    3. Search for text ‘# LoadModule’ and then scroll down to the bottom of the section containing the LoadModule entries. Enter the following:# ReportBuilder WebTier<Location /report></Location>
    4.           SetHandler mod_report-handler
    5. LoadModule rbwebtier_module modules/
    6. Search for the text ‘# Aliases’ and then scroll down to the bottom of the section. Enter the following:

# ReportBuilder WebTier directories

Alias /rbcache/ “C:/Program Files/Apache Group/Apache2/rbcache/”

<Directory “C:/Program Files/Apache Group/Apache2/rbcache”>

Options All

AllowOverride None

Order allow,deny

Allow from all


Create an Apache Shared Module
  1. Launch Delphi.
  2. Select File | New | Other… from the Delphi menu.
  3. Scroll to the bottom row of icons, select Web Server Application and click OK.
  4. Select Apache Shared Module and click OK.
Create the WebTier
  1. Select the RBServer tab of the Delphi component palette.
  2. Add a WebTier   component to the web module.
  3. Configure the WebTier as follows, replacing ‘hostaddress’ with the IP address of your machine:
     CacheDirectory  c:\ApacheRoot\rbbin\rbcache
     WebCachePath  http://hostaddress/rbcache
     WebModuleURI  http://hostaddress/rbbin/Report.dll

    You can quickly determine the IP address of your machine by running Start | Programs | Accessories | Command Prompt from your Windows desktop and entering ‘ipconfig’ after the command prompt.

  4. Expand the ServerConnection property.
  5. Set Address to the IP address of the machine on which the report server application is running.*
  6. Set Port to the port on which the report server application is ‘listening’.*

*For more information on building a report server application, see the Developer’s Guide in …RBServer\Developer’s Guide.

Create the Default Action
  1. Right-click over the web module and select Action Editor.
  2. Add an Action to the list.
  3. Set the Default property of the Action to True.
  4. Code the OnAction event of the Action as:

Response.Content := rsWebTier1.ProcessWebRequest(Request.QueryFields,  Request.Content);

Save and Test the Application
  1. Select File | Save Project As… from the Delphi menu.
  2. Save ‘Unit1’ as ‘wmApache’.
  3. Save ‘Project1’ as ‘Report’.
  4. Compile the project.
  5. Copy the resulting Report.dll to:C:\ApacheRoot\rbbin
  6. Start the Apache web server.
  7. Run a web browser and enter the following address, replacing ‘hostaddress’ with the IP address of your machine: