You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Richard Clarke <ri...@likewhoa.com> on 2003/04/02 23:57:41 UTC

Configuration with

I'm fairly sure my head is about to explode from frustration here. Any help
would be MUCH appreciated.

I'm trying to get my httpd.conf working with <perl>..</perl>, however things
don't seem to be working out.
As soon as I add either $PerlModule or $PerlRequire for any module, apache
seems to try load/bind/or something, itself "twice"?

[Wed Apr  2 21:52:50 2003] [warn] VirtualHost 10.10.10.1:3128 overlaps with
VirtualHost 10.10.10.1:3128, the first has precedence, perhaps you need a
NameVirtualHost directive
[Wed Apr  2 21:52:50 2003] [warn] VirtualHost 10.10.10.2:3128 overlaps with
VirtualHost 10.10.10.2:3128, the first has precedence, perhaps you need a
NameVirtualHost directive
[Wed Apr  2 21:52:50 2003] [crit] (48)Address already in use: make_sock:
could not bind to address 10.10.10.2 port 3128

This happens no matter where in the file or what in order I put these
directives.

Did I make a massive oversight when reading the documentation on this?


Richard.



Re: Configuration with

Posted by Richard Clarke <ri...@likewhoa.com>.
Perrin,
    Somehow I managed to completely miss your reply to my question until
just now I tried googling for a solution to my problem and saw your reply.

> Yes.  See
>
http://perl.apache.org/docs/1.0/guide/config.html#Apache_Restarts_Twice_On_S
tart
>

This is happening when I first start the server, apachectl start, httpd -X
.. they all cause half of my <perl> section to be processed twice.. or at
least MOD_PERL_TRACE shows half the configuration directives being set twice
even though they only appear once.
    I thought I had fixed it after upgrading from 5.6.1 to 5.8 but alas I
was temporarily tricked :(

print STDERR "Server is Starting\n"   if $Apache::Server::Starting;
print STDERR "Server is ReStarting\n" if $Apache::Server::ReStarting;

Sticking this code in my <perl> section only results in the first line being
printed.

> I don't use <Perl> sections, so I've never had this problem before, but
> it seems strange that this should trigger complaints from something like
> setting a virtual host.  Maybe you should clear the virtual host
> settings at the top of your <Perl> code.
>

I never used them until I had a brainwave that I could centralise my site
configuration by moving all my different server settings into a database and
autogenerating the config based on where apache was being booted from..

My problem can be shown using a completely minimal configuration file so I'm
sure someone else must have come across this before or at least there must
be some caveat I have overlooked in the documentation.

The vhost clash doesn't actually stop anything working.. at least not now..
at the start apache just refused to serve anything, now it all works apart
from the bombardment of "this vhost overlaps with that vhosts" messages at
the start.

Richard.


Re: Configuration with

Posted by Perrin Harkins <pe...@elem.com>.
Richard Clarke wrote:
> foreach my $l (qw/ErrorLog TransferLog LockFile PidFile ScoreBoardFile/) {
>      $$l          = "/usr/local/app/apache_modperl/logs/$l";
> };

Dude, you're scaring me with that.  It looks just like $1 and $$1.

> PERL_TRACE output clearly shows that half of the perl section is being
> processed twice, causing a VirtualHost overlap warning.
> Is it supposed to work like this?

Yes.  See 
http://perl.apache.org/docs/1.0/guide/config.html#Apache_Restarts_Twice_On_Start

I don't use <Perl> sections, so I've never had this problem before, but 
it seems strange that this should trigger complaints from something like 
setting a virtual host.  Maybe you should clear the virtual host 
settings at the top of your <Perl> code.

- Perrin


Re: Configuration with

Posted by Richard Clarke <ri...@likewhoa.com>.
List,
    No matter what I can't understand why the following tiny <perl>
configuration won't work.
If I comment out $ServerRoot, it works. If I instead comment out
DocumentRoot, it works.
If I comment out $$l, it works..... I don't understand :(

<Perl>
#!perl -w

$ServerRoot             = "/usr/local/app/apache_modperl";
$DocumentRoot           = "/usr/local/app/static";

$PerlRequire            = "/usr/local/app/conf/startup.perl";

foreach my $l (qw/ErrorLog TransferLog LockFile PidFile ScoreBoardFile/) {
     $$l          = "/usr/local/app/apache_modperl/logs/$l";
};

$VirtualHost{"10.10.10.42:3128"} = {
                                    ServerName => "mp2.local.com"
                                   };

</Perl>


startup.perl only contains,
#!/usr/bin/perl -w
use strict;

use lib qw (/usr/local/app/lib);

1;


PERL_TRACE output clearly shows that half of the perl section is being
processed twice, causing a VirtualHost overlap warning.
Is it supposed to work like this?

Richard.