httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krist van Besien" <krist.vanbes...@gmail.com>
Subject Re: [users@httpd] mod_perl and vhost configs
Date Wed, 20 Aug 2008 13:47:49 GMT
On Wed, Aug 20, 2008 at 14:42, Peter Milanese <milanesefamille@yahoo.com> wrote:

> $parms->add_config() has failed: Include takes one argument, Name of the
> config
>  file to be included at
> /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/Apache2/PerlSections.pm
> line 215.\n

It looks like "$include" is getting the value "Include" without an
include file name. The reason is very simple. You forgot to declare
$include as local.

In this line

  if (-e $siteconf){$include="Include $siteconf"}else{$include="";}

Since $siteconf doesn't exist (because it is empty, as you probably
intended to use $site_conf here) the statement "$include="" is
executed. Since you didn't declare $include as local perl now tries to
set the Apache directive "include" to an empty string, which throws an
error.
You need to go over your code, correct the obvious mistakes
($site_conf in stead of $siteconf) but also you need to declare every
variable that you use, and that is not meant to be treated as
directive, as local.
So you need to add something like this somewhere near the beginning of
your code.
my  (@sites, @vhost_conf, $site_conf, $site_name, $include) ;

It is very important to be aware that when using perl for apache
configs scope becomes a lot more important than you are probably used
to. Any variable that doesn't have local scope is treated as a
potential apache directive, so when you, as happesn here, use a
variable with a name identical to a directive you can have a problem.
It is in my experience the most common error.

> The documentation is a bit high level view, as I have found. Is there
> anything more detailed, in examples or otherwise, or
> is it best just to trace the mod?

There is not a lot of docu. I had to find out a lot by trial and
error, stripping out the complex parts until I had a simple config
working, and than adding in some complexitiy. But I am quite happy
with the result. I run a whole collection of servers all with the same
config...

 It may be helpfull to print out the values of some variables during
processing. I would use lines like:

print STDOUT "Virtual host name =
print STDOUT "Include file = $site_config";

etc...

HTH,

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message