Re: mod_perl and vhost configs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 20, 2008 at 14:42, Peter Milanese <milanesefamille@xxxxxxxxx> 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@xxxxxxxxx
krist@xxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx


[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux