ISAPI and so

Motaz
Motaz used Ask the Experts™
on
I installed apache 2.
How can I execute ISAPI dll and .so files,
how can I configure it, and where should I put it, in cgi-bin?

and how can I call it from the browser.
I'm using Windows 2000
Thanks
Motaz
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
ISAPI Dll and .so files are Apache loadable modules. These are loaded when the server is started. These are designed as helper functions for web server.

You can put these files whereever you want (No restriction). Only restrictions is that the server should have suficient permission for those files. Normally the .so files are put in the modules directory.

Check C:\Program Files\Apache Group\Apache2\modules directory

To configure youhave to use the LoadModule directive.

The syntax is

LoadModule module filename

eg:
   LoadModule access_module modules/mod_access.so

another example:
Loading php ISAPI module

   LoadModule php4_module c:/php/sapi/php4apache.dll
   AddModule mod_php4.c
   AddType application/x-httpd-php .php

Note: PHP ISAPI module is still experimental and may not work.

Need further clarification? Please let me know.

bansidhar

Author

Commented:
Thanks for your reply,
but how can I call that files from the browser.
There is already existing .so files in modules directory, but I don't know how to call it.

Motaz
As I stated earlier these are for adding additional functionality to the server. You don't have to call it. It is being called from the web server as and when require.

for example:

If you run any PHP script the server calls the php4apache.dll to parse the script and sends you the result.

bansidhar
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

Author

Commented:
I mean, how the clients use this web application,
for example:

http://myservername/mydll.dll
or
http://myservername/myDSO.so

Motaz
These are not web application. These are web server extensions and cannot be called from the client as you are refering.

Author

Commented:
So what is the difference between web server application and extension.
I'm using Delphi to generate CGI web applicaion, and it works fine in apache, then I changed that CGI to ISAPI in Delphi by changing some lines, but the application is the same (Web application).
Motaz
Here you can call the ISAPI same way you were calling the CGI.

Author

Commented:
I tried to call it, but I get permission error
Can you give me the details of the exact error you are getting.

"ISAPI extensions are governed by the same permissions and restrictions as CGI scripts. That is, Options ExecCGI must be set for the directory that contains the ISAPI .dll file"

Please go through
http://httpd.apache.org/docs/mod/mod_isapi.html

bansidhar

Author

Commented:
I put ISAPI dll inside cgi-bin directory.
I get "You have no permission to run this file"

Motaz

Author

Commented:
I already added this line in configuration file:

AddHandler isapi-isa .dll
Commented:
It doesn't work, because ISAPI/DSO isn't the same as a CGI.
A CGI is an application run on a webserver.
An ISAPI/DSO is a module loaded by the webserver and run within the process of it.

To use a DSO one needs access to configure the server httpd.conf

To install a Delphi DSO (I've actually just learnt this approx. 1 hour ago, doing it myself) you should do this:
Open httpd.conf
Go to the place under all of the "AddModule"'s
There you insert the following:

---BEGIN---
LoadModule name_of_module path/to/module.so
<Location /triggerpath>
SetHandler module-handler
</Location>
----END----

In that you replace the following:
------
name_of_module with the module name defined in the main project file
(more specifically the place saying name_of_module in the following:
exports
  apache_module name 'name_of_module'; )
------
path/to/module.so with the path and filename of the .SO file. E.g. if you called it mod_qwerty.so and placed it in the Apache/modules directory you write: modules/mod_qwerty.so
------
/triggerpath with the path which should trigger the application. Basically where to access it. E.g. if set to /qwerty you can access it at 127.0.0.1/qwerty
------
module-handler with the name of the handler. Quite hard to find, but usually the filename without the .SO followed by a "-handler". E.g. filename's mod_qwerty.so, then the handler usually is mod_qwerty-handler
------

Then you restart the server and it should work.



----------------
Personally I got most of the info from http://www.blong.com/Articles/Apache%20For%20Windows/ApacheWindows.html#WritingDSOs which is the first hit on Google for: delphi apache shared
----------------

If it still doesn't work or is too messy an explanation, check the site. If still nothing, tell us.

--- Hope I helped and wasn't too messy

Author

Commented:
I do that steps:

LoadModule Mediations_module modules/MonitorDSO.so

<Location /mediations>
SetHandler MonitorDSO-handler
</Location>

but I cann't start the service, it gave me this error:

Syntax error on line 173 of C:/Program Files/Apache Group/Apache2/conf/httpd.con
f:
Cannot load C:/Program Files/Apache Group/Apache2/modules/MonitorDSO.so into ser
ver: The specified module could not be found.

I tried to rename the file to m.so for case sensitivity, also I get the same error
I put that file in modules directory
Motaz

Commented:
Did you create it as an Apache 1.x shared module?

You can check if you did by looking at the DPR's source.

If if's for Apache 1.x the uses clause should be something like this for a standard SO:

uses
  WebBroker,
  ApacheApp,
  Unit1 in 'Unit1.pas' {WebModule1: TWebModule};

If that's the case, then you need to change the ApacheApp to ApacheTwoApp, so it looks something like this:

uses
  WebBroker,
  ApacheTwoApp,
  Unit1 in 'Unit1.pas' {WebModule1: TWebModule};

Author

Commented:
I'm using IntraWeb in Delphi 7
no WebBrocker at all
I tried Apache 1, and Apache 2 DSO, but I get the same result

Commented:
And you're 100% positive the file's located in C:/Program Files/Apache Group/Apache2/modules?

Author

Commented:
Yes, I'm sure.
I even write it in case sensitive

Author

Commented:
Finally I decided not to use Apache at this time, may be I may use it in newer versions when they make a GUI settings same like IIS, and after they support ISAPI without writing alot of lines in mystery httpd.conf

Thanks every one
Motaz
www.geocities.com/motaz1

Commented:
I have encountered exactly the same problem. It does not seem to be caused by syntax errors but actually a problem in the format of the .so file. One of the Delphi developers put up a link for an unofficial patch to get Delphi 7 to work for Apache versions greater than 2.0.39 at http://www.drbob42.com/delphi7/apache2040.htm. I believe that this is causing the problem and this patch may fix the problem. I haven't used it yet but it seems like the most likely solution.

Commented:
I seem to have found the cause of your .so problem Motaz. Basically it is being caused by the "brilliant" documentation from IntraWeb. In order to get even a basic IntraWeb DSO to work you need to change quite a bit.

Firstly you need to change the delphi source as described in the link ttp://www.drbob42.com/delphi7/apache2040.htm. Then copy these 3 pas files into your project directory and include them in the project.

ApacheTwoApp
ApacheTwoHTTP
HTTPD2

The only one you edit is HTTPD2 but the others are dependent.

Secondly you need to change the IWInitApache to IWInitApacheTwo and then it seems to work fine. Just stick it in the modules directory, setup the LoadModule and Location in the .conf file. See http://www.blong.com/Articles/Apache%20For%20Windows/ApacheWindows.html#WritingDSOs. And it should all come together.

Fluffy54

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial