James.B.Muir at hitchcock
Jun 21, 2011, 9:57 AM
Post #25 of 26
Getting back to basics... Are you sure that your build of Apache and perl went well? Have you scrutinized the logs you created when you built perl and apache for any surprising error messages?
From: William Bulley [mailto:web [at] umich]
Sent: Tuesday, June 21, 2011 12:51 PM
To: Andr? Warnier
Cc: mod_perl list
Subject: Re: apache2 or mod_perl2 oddball error
According to Andr? Warnier <aw [at] ice-sa> on Tue, 06/21/11 at 12:05:
> Right, but what that page is showing, is the syntax of the perl "use
> some::module;" directive, as used /inside of a perl program/.
> Here we are talking about the "PerlModule" directive, as used in a
> httpd.conf file (or another file included in it).
I got that.
> Although the effect of each of these instructions is quite similar, the
> allowable syntax in each case may be different.
> Referring again to the page
> One sees there an example of a PerlModule directive with several parameters
> after the "PerlModule" directive itself. But these additional parameters
> are, all and each of them, names of perl modules (aka "libraries") to be
> loaded. They are /not/ additional parameters to the first named module.
> Damn, this is probably obscure for a non-perl practitioner. Let me try
> again :
> in a line like
> use Apache2::Const -compile => ':common';
> (which you would use in a perl script, not in an Apache configuration file)
> - the "use Apache2::Const" part means : load the module "Apache2::Const"
> - and the "-compile => ':common'" part means : /in addition/ to loading the
> Apache2::Const module itself, also "prepare" a set of symbols from that
> module, so as to make them easier to use in the program which executes the
> "use" directive. (*)
I think the person who wrote these lines:
PerlModule "Apache2::Const -compile => ':common'"
PerlModule "APR::Const -compile => ':common'"
was trying to say: "I'm only interested in those symbols associated with
the ':common' tag, so please load only those (in addition to the module)."
But this is neither here nor there, since when I reduce those two lines to:
and re-run "# apachectl -t" the syntax is clean, but the server fails to
start (which was my original complaint):
Attempt to free unreferenced scalar: SV 0x28be1014 during global destruction.
Attempt to free unreferenced scalar: SV 0x28bda578 during global destruction.
Attempt to free unreferenced scalar: SV 0x28bda7d0 during global destruction.
Attempt to free unreferenced scalar: SV 0x28d1b3e8 during global destruction.
Attempt to free unreferenced scalar: SV 0x28d1b050 during global destruction.
Attempt to free unreferenced scalar: SV 0x28bda730 during global destruction.
Attempt to free unreferenced scalar: SV 0x28bda4b0 during global destruction.
Attempt to free unreferenced scalar: SV 0x28d1b3d4 during global destruction.
Attempt to free unreferenced scalar: SV 0x28be176c during global destruction.
Attempt to free unreferenced scalar: SV 0x28bda6cc during global destruction.
Attempt to free unreferenced scalar: SV 0x28be15dc during global destruction.
> On the other hand, in an Apache configuration file, you cannot use the
> "use" directive, you must use the "PerlModule" directive. But this
> PerlModule directive has no valid syntax to allow the second part
> ("-compile => ':common'").
> Ok so far ?
I got that.
> So how would you find a way to tell Apache and mod_perl to load the
> Apache2::Const module, but /also/ do the "-compile => ':common'" part ?
> Fortunately, in Perl there is always more than one way to do it.
> That's where the already-named "startup.pl" script comes into play, along
> with the "PerlRequire" directive.
The include file in question has a <Perl>...</Perl> section. So I tried
putting the "use...-common => ':common'" inside there (two lines). Then
running the apachectl(8) command, I got the same results as above. Still
I got farther along just by renaming the include file so that apache2
could not see it (but of course this screws the pooch for the application
in question). After the renaming, "# apachectl start" succeeded.
> By using the Apache/mod_perl configuration directive
> PerlRequire "/path/to/some/script.pl"
> you tell Apache and mod_perl to also compile and run the named script,
> /during the Apache configuration phase/. And in this script, you can use
> the line :
> use Apache2::Const -compile => ':common';
> (because in a Perl script the "use" directive /can/ be used, with the
> additional parameters and all).
> (Note: the name of this script is often "startup.pl", but that is only a
> convention, and you can use any script name you like, as long as the
> PerlRequire directive points to it).
I do this for Perl applications that I write.
> (Note also that it does not matter that the rest of the application never
> references this script; it is executed /once/ during the configuration
> phase of Apache, and just sets things up for the rest of the life of this
> Apache/mod_perl server).
I got that.
> In other words, to summarise (and this is only a repeat of what someone
> else wrote earlier), do as follows :
> - create a simple perl script, for example as
> "/etc/apache2/mod_perl_startup.pl", as Fred Moyer told you how to in a
> reply dated 17/06 22:22.
> - remove the corresponding PerlModule line from the Apache configuration
> file (or comment it out)
> - add the above "PerlRequire" line to your Apache configuration
> The fundamental effect should be the same, but the perl language "use"
> directive allows for additional parameters such as "-compile", while this
> is less than certain for the Apache/mod_perl "PerlModule" configuration
> (*) for example, it means that in all other perl programs, modules, scripts
> running under your Apache/mod_perl, you can now use :
> return OK;
> instead of the longer
> return Apache2::Const::OK;
I am still at a loss as to how to proceed. Ignoring the Apache2::Const
and APR::Const issues, the apache2 server still fails to start. And I
don't know how to track down the problem. Changing "Loglevel" to "debug"
in the httpd.conf file did not result in any errors logged to my apache
error log file (since the server failed to run). Is this still a Perl
problem or could it be a mod_perl2 problem? And how to debug it?
William Bulley Email: web [at] umich
72 characters width template ----------------------------------------->|
IMPORTANT NOTICE REGARDING THIS ELECTRONIC MESSAGE:
This message is intended for the use of the person to whom it is addressed and may contain information that is privileged, confidential, and protected from disclosure under applicable law. If you are not the intended recipient, your use of this message for any purpose is strictly prohibited. If you have received this communication in error, please delete the message and notify the sender so that we may correct our records.