“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
- Create the ReportBuilder web cache directory:C:\Program Files\Apache Group\Apache2\rbCache
- Open the Apache configuration file (use Notepad or any text editor).C:\Program Files\Apache Group\Apache2\Conf \httpd.conf
- 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>
- SetHandler mod_report-handler
- LoadModule rbwebtier_module modules/mod_report.so
- 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”>
Allow from all
Create an Apache Shared Module
- Launch Delphi.
- Select File | New | Other… from the Delphi menu.
- Scroll to the bottom row of icons, select Web Server Application and click OK.
- Select Apache Shared Module and click OK.
Create the WebTier
- Select the RBServer tab of the Delphi component palette.
- Add a WebTier component to the web module.
- 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
Note: 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.
- Expand the ServerConnection property.
- Set Address to the IP address of the machine on which the report server application is running.*
- 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
- Right-click over the web module and select Action Editor.
- Add an Action to the list.
- Set the Default property of the Action to True.
- Code the OnAction event of the Action as:
Response.Content := rsWebTier1.ProcessWebRequest(Request.QueryFields, Request.Content);
Save and Test the Application
- Select File | Save Project As… from the Delphi menu.
- Save ‘Unit1’ as ‘wmApache’.
- Save ‘Project1’ as ‘Report’.
- Compile the project.
- Copy the resulting Report.dll to:C:\ApacheRoot\rbbin
- Start the Apache web server.
- Run a web browser and enter the following address, replacing ‘hostaddress’ with the IP address of your machine: