Thanks for telling me a ticket.
In fact, I had already read the code of 'fpapache' unit.
According to the patch of ticket, registration of the hook seems to have
been fixed.
By the way, in the test code does not use TCustomApacheApplication. The
code which register hook is also written. (And my program is not using
fpWeb)
The error that exists in the ticket is not displayed. Seemingly, start of
httpd seems to success. However, the process terminate immediately.
Is there another possible cause?
Takashi
On Fri, 27 May 2011 05:55:14 +0900, ABorka <fpc-de...@aborka.com> wrote:
On 5/26/2011 13:36, Takashi Ishikawa wrote:
Hello, all
I'm writing apache module with fpc.
When I compile my program on fpc 2.4.4, Apache terminate immediately.
But on fpc 2.2.4, Apache and my module will work fine.
Code is compiled with no problem. Apache can load module. But the
running has problem.
Is there anyone who running a module compiled with fpc 2.4.x on Apache?
I tested some envirment:
- OS: CentOS 5.5 / Fedora 12
- Apache: 2.2.3 / 2.2.17
- Arch: x86_64
- FPC: 2.2.4 / 2.4.2 / 2.4.4
Test code:
-----
library lib_mod_simple;
{$ifdef fpc}
{$mode objfpc}{$H+}
{$endif}
uses SysUtils, httpd, apr;
var
mod_simple: module; public name 'mod_simple';
exports
mod_simple name 'mod_simple';
function DefaultHandler(r: Prequest_rec): Integer; cdecl;
begin
Result := DECLINED;
end;
procedure RegisterHooks(p: Papr_pool_t); cdecl;
begin
ap_hook_handler(@DefaultHandler, nil, nil, APR_HOOK_MIDDLE);
end;
begin
FillChar(mod_simple, SizeOf(mod_simple), 0);
STANDARD20_MODULE_STUFF(mod_simple);
with mod_simple do
begin
name := 'mod_simple.so';
register_hooks := @RegisterHooks;
end;
end.
-----
Compilation options:
-----
fpc -Xs -XX -fPIC -dFPCAPACHE_2_2 -omod_simple.so mod_simple.pas
-----
LoadModule in httpd.conf:
-----
LoadModule mod_simple modules/mod_simple.so
-----
Test#1 with CentOS 5.5, Apache 2.2.3, FPC 2.2.4
-----
# gdb httpd
(gdb) r -X
Starting program: /usr/sbin/httpd -X
[Thread debugging using libthread_db enabled]
Detaching after fork from child process 28066.
Detaching after fork from child process 28080.
-----
Test#2 with CentOS 5.5, Apache 2.2.3, FPC 2.4.4
-----
# gdb httpd
(gdb) r -X
Starting program: /usr/sbin/httpd -X
[Thread debugging using libthread_db enabled]
Detaching after fork from child process 28119.
Program exited normally.
(gdb)
-----
Test with CentOS 5.5, Apache 2.2.3, FPC 2.4.2
Test with CentOS 5.5, Apache 2.2.3, FPC 2.4.4
Test with Fedora 12, Apache 2.2.17, FPC 2.4.4
same as Test#2
In test#1, it seemed to be success. When I access the webserver with
browser, apache respond normal page.
In test#2, apache shows no error. But process terminate. And when I
accessed the webserver, apache didn't respond.
It is possible to develop by using FPC 2.2.4. However, the future, I
want to compile with a newer version of FPC. Is there any idea to
running module with FPC 2.4.x?
Thanks,
Takashi
There were problems with apache modules that were fixed in the latest
FPC SVN (bug report 19184).
If you do not want to use the SVN versions of FPC/Lazarus, you can just
download the latest packages/fcl-web/src/base/ files from SVN into your
project directory and recompile your project.
Also, make sure you compile with the httpd22 directory and that
FPC/Lazarus is not accidentally uses httpd13 or httpd20 . The best if
you just delete these two directories from your fpc units directory.
AB
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
_______________________________________________
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal