Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Basic Apache Web Broker Module - non-starter


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Kevin Morris

Posts: 52
Registered: 1/8/13
Basic Apache Web Broker Module - non-starter  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jul 17, 2016 12:08 PM
I'm just starting to learn about building Apache webbroker modules in Delphi.
I'm using Apache 2.4, (64bit) and DXE7 on Windows 2012 Server.

Apache refuses to start, with the error: "web_broker.dll is not a valid Win32 application"

My module .dll is 32bit and is in the Apache modules folder.

Here is my code and configuration:

Delphi:




unit WebModuleUnit1;
 
interface
 
uses System.SysUtils, System.Classes, Web.HTTPApp;
 
type
  TWebModule1 = class(TWebModule)
    procedure WebModule1DefaultHandlerAction(Sender: TObject;
      Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
 
var
  WebModuleClass: TComponentClass = TWebModule1;
 
implementation
 
{%CLASSGROUP 'Vcl.Controls.TControl'}
 
{$R *.dfm}
 
procedure TWebModule1.WebModule1DefaultHandlerAction(Sender: TObject;
  Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);
begin
  Response.Content :=
    '<html>' +
    '<head><title>Web Server Application: Kevin Morris</title></head>' +
    '<body>Web Server Application built by Kevin Morris</body>' +
    '</html>';
end;
 
end.
 
 
library mod_webbroker;
 
uses
  Winapi.ActiveX,
  System.Win.ComObj,
  Web.WebBroker,
  Web.ApacheApp,
  Web.HTTPD24Impl,
  WebModuleUnit1 in 'WebModuleUnit1.pas' {WebModule1: TWebModule};
 
{$R *.res}
 
// httpd.conf entries:
//
(*
 LoadModule webbroker_module modules/mod_webbroker.dll
 
 <Location /xyz>
    SetHandler mod_webbroker-handler
 </Location>
*)
//
// These entries assume that the output directory for this project is the apache/modules directory.
//
// httpd.conf entries should be different if the project is changed in these ways:
//   1. The TApacheModuleData variable name is changed
//   2. The project is renamed.
//   3. The output directory is not the apache/modules directory
//
 
// Declare exported variable so that Apache can access this module.
var
  GModuleData: TApacheModuleData;
exports
  GModuleData name 'webbroker_module';
 
begin
  CoInitFlags := COINIT_MULTITHREADED;
  Web.ApacheApp.InitApplication(@GModuleData);
  Application.Initialize;
  Application.WebModuleClass := WebModuleClass;
  Application.Run;
end.
 




Apache .conf


 LoadModule webbroker_module modules/mod_webbroker.dll
 
 <Location /xyz>
    SetHandler mod_webbroker-handler
 </Location>
 




Edited by: Kevin Morris on Jul 17, 2016 12:08 PM I added {code} tags to the Apache .conf section.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02