Hi John,
Thanks for your fast reply!
> I'm CC-ing the mod_cplusplus users list (we can take it off users@httpd
> if you like). I can help out later today on this, in the mean time can yo=
u
> send me the version of apache and mod_cplusplus you are using (from cvs?)=
.
Ok. I sent the mail to the httpd list because I saw little activity on
the mod_cplusplus, sorry... But now modcpluspus-users seems more
appropriate (and I subscribed).
I'm using apache 2.0.40, the latest available version (I think so) from
www.apache.org. mod_cplusplus is version 1.0.2 ("Apache2_GA4"), from
your page at SourceForge. There are more details about my system in the
first message below.
Now that you have been so kind to answer, I'll send you more specific
information about my efforts, hope I don't bore you :)
This are the lines I added to httpd.conf to test my module and your
samples:
---begin
LoadModule cplusplus_module modules/libmod_cplusplus.so
LoadCPPHandler hello_world modules/libmod_HelloWorld.so
LoadCPPHandler test_handler modules/libtest_handler.so
LoadCPPHandler test_input_filter modules/libtest_input.so
<Location /hello-world>
SetHandler hello-world
AddCPPHandler hello_world
</Location>
<Location /test-handler>
SetHandler test-handler
AddCPPHandler test_handler
</Location>
AddCPPConnectionInputFilter test_input_filter
<Location /test-input>
SetHandler cpp-handler
AddCPPHandler test_input_filter
</Location>
---end
I think they are correct (?), as I said, because everything works with
"-X". I tried only some of them, as I explained (only one c++ module at
a time), and the result is the same. Loading only mod_cplusplus.so works
fine, but I can't do any AddCPPHandler.
My module is VERY simple:
---begin
#include "apache_handler.h"
class mod_HelloWorld : public ApacheHandler
{
public:
mod_HelloWorld( void );
~mod_HelloWorld( void );
int handler( ApacheRequestRec *pRequest );
};
extern "C" cpp_factory_t hello_world;
mod_HelloWorld::mod_HelloWorld() : ApacheHandler()
{
fprintf(stderr, "foo\n"); // or whatever...
}
mod_HelloWorld::~mod_HelloWorld()
{
fprintf(stderr, "bar\n");
}
int mod_HelloWorld::handler( ApacheRequestRec *pRequest )
{
pRequest->content_type( "text/html" );
pRequest->rputs( "<HTML>\n" );
pRequest->rputs( "<TITLE>M=F3dulo Hello World</TITLE>\n" );
pRequest->rputs( "<H1>HELLO WORLD</H1>\n" );
pRequest->rputs("</BODY></HTML>\n");
return OK;
}
ApacheHandler* instanciate_HelloWorld()
{
return new mod_HelloWorld();
}
cpp_factory_t hello_world =3D {
instanciate_HelloWorld,
NULL,
NULL,
NULL,
};
--end
I compiled it by hand (-fPIC, -shared to gcc...) and by modifying the
Makefiles in your samples. In both ways the result was the same :(
Everything works and I can see the "Hello World" with -X, as I said.
Any hint? Thank you very much again for your help.
Pachi.
PS: It's late now here, so I'm afraid I won't be able to respond very
quickly if you need any other information... I'll check mail early
tomorrow.
> >-- Original Message --
> >Subject: httpd crash at startup with custom c++ (mod_cplusplus) module
> >From: Pachi Sucunza <pa...@sc...>
> >To: us...@ht..., jo...@st...
> >Date: 26 Aug 2002 16:45:38 +0200
> >
> >
> >Hi everyone
> >
> >I have written an Apache module in C++ (using mod_cplusplus...
> >http://modcplusplus.sourceforge.net/ )
> >The problem is that I can't get any C++ module working, the httpd proces=
s
> >dies right after initialization, without any complaint or message (in st=
dout
> >or any of the log files).
> >
> >I'll try to explain more thoroughly the situation:
> >- I'm running Linux - Debian 2.2 (potato), kernel 2.2.19-smp on a 2x1GHz
> > Intel Pentium III. I use Apache 2.0.40. mod_cplusplus is the latest ve=
rsion
> >(1.0.2).
> > My compiler is gcc 2.95.2 (the one packaged by Debian).
> >- I configured and compiled Apache, and mod_cplusplus, without problems.
> >- I changed httpd.conf accordingly, to load mod_cplusplus and my module
> > (as in the mod_cplusplus sample configuration files), copied modules
> in
> >the
> > "modules" directory, etc.
> >- When I launch httpd, the mod_cplusplus initialization is done, and the=
n
> >the one
> > in my custom module. After this (FIRST initializations), the server di=
es
> >without
> > any message.
> >- If I just load mod_cplusplus module, but none of the C++ modules, the
> server
> > doesn't die (but it's not very useful... :)
> >- If I launch apache with the "-X" option (single-process mode), EVERYTH=
ING
> >works
> > PERFECTLY: mod_cplusplus, mod_cplusplus samples, and my module. That's
> >why I think
> > that the setup (httpd.conf) is right, and that my compilation and link=
ing
> >seem
> > correct, too.. (?)
> > With that switch, mod_cplusplus' and my module's initialization are ca=
lled
> >the second
> > time, and everything starts working OK.
> >- I've tried different settings to compile Apache (--enable-rule=3DSHARE=
D_CORE,
> > --enable-module=3Dmost --enable-mods-shared=3Dmost, different MPM's...=
),
> all
> > of them with the same results.
> >- I've tried all of this in a non-SMP machine, also with the same result=
s.
> >- I've reduced my module to a minimum, just a few "pRequest->rputs( ...
> );",
> > content-type, etc.. in the "handler()" method. So I think it cant't be
> >(for the
> > moment :) a bug in my code.
> >- With the mod_cplusplus sample modules, the result are always the same
> as
> >with my
> > little module.
> >
> >Any hints? Anyone had any similar problem, even if not using mod_cpluspl=
us?
> >Could it be a compiling/linking problem? Or with libraries?
> >
> >Any help would be *HIGHLY* appreciated, as I don't know what else can I
> try...
> >
> >Best regards,
> >
> >Pachi.
> >
> >
|