You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stefan Cars <st...@snowfall.se> on 2004/02/15 00:05:47 UTC

and

Hi!

I'm having trouble getting doing some perl configuration within
<Perl></Perl> in httpd.conf with Apache 2 and mod_perl 2 (both latest
version as of today). Using this do not work:

use Apache::DBI;
use Snowfall::Database3;
use Apache::PerlSections ();
use Apache::ServerUtil ();
use Apache::Server;
my $s = Apache->server;
....
$s->add_config("<VirtualHost x.x.x.x>");
...


But this doesn't work, it still says that "namevirtualhost x.x.x.x does
not have any virtualhosts".


I have tried to go the "real" way of using $VirtualHost{'213....'} but the
problem occurs when I have to use RewriteRule etc, and want to have the
entries come out the same way they came into the hash (and using
Tie::IxHash isn't really working very well).

Anyone have any ideas??


Kind Regards,
Stefan Cars


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: and

Posted by Stas Bekman <st...@stason.org>.
Stas Bekman wrote:
> Stefan Cars wrote:
> 
>> Here is my code:
>>
>>
>> $s->add_config('<VirtualHost x.x.x.x>');
>> $s->add_config('ServerAdmin xxx@xxx.xxx');
>> $s->add_config('ServerName www.xxx.xxx');
>> $s->add_config('DocumentRoot /xxx/xxx/xxx');
>> $s->add_config('ErrorLog logs/xxx-error_log
>> $s->add_config('</VirtualHost>');
> 
> 
> It should be:
> 
>  $s->add_config(
> ['<VirtualHost x.x.x.x>',
> 'ServerAdmin xxx@xxx.xxx',
> 'ServerName www.xxx.xxx',
> 'DocumentRoot /xxx/xxx/xxx',
> 'ErrorLog logs/xxx-error_log',
> '</VirtualHost>']);
> 
> or:
> 
> my $vhost = <<EOI;
> <VirtualHost x.x.x.x>
>   ServerAdmin xxx@xxx.xxx
>   ServerName www.xxx.xxx
>   DocumentRoot /xxx/xxx/xxx
>   ErrorLog logs/xxx-error_log
> </VirtualHost>
> EOI
> $s->add_config(split /\n/, $vhost);

opps: make the last line:

$s->add_config([split /\n/, $vhost]);


-- 
__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: and

Posted by Stas Bekman <st...@stason.org>.
Stefan Cars wrote:
> Here is my code:
> 
> 
> $s->add_config('<VirtualHost x.x.x.x>');
> $s->add_config('ServerAdmin xxx@xxx.xxx');
> $s->add_config('ServerName www.xxx.xxx');
> $s->add_config('DocumentRoot /xxx/xxx/xxx');
> $s->add_config('ErrorLog logs/xxx-error_log
> $s->add_config('</VirtualHost>');

It should be:

  $s->add_config(
['<VirtualHost x.x.x.x>',
'ServerAdmin xxx@xxx.xxx',
'ServerName www.xxx.xxx',
'DocumentRoot /xxx/xxx/xxx',
'ErrorLog logs/xxx-error_log',
'</VirtualHost>']);

or:

my $vhost = <<EOI;
<VirtualHost x.x.x.x>
   ServerAdmin xxx@xxx.xxx
   ServerName www.xxx.xxx
   DocumentRoot /xxx/xxx/xxx
   ErrorLog logs/xxx-error_log
</VirtualHost>
EOI
$s->add_config(split /\n/, $vhost);


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: and

Posted by Stefan Cars <st...@snowfall.se>.
Here is my code:


$s->add_config('<VirtualHost x.x.x.x>');
$s->add_config('ServerAdmin xxx@xxx.xxx');
$s->add_config('ServerName www.xxx.xxx');
$s->add_config('DocumentRoot /xxx/xxx/xxx');
$s->add_config('ErrorLog logs/xxx-error_log
$s->add_config('</VirtualHost>');


On Sat, 14 Feb 2004, Stas Bekman wrote:

> Stefan Cars wrote:
> > Hi!
> >
> > Of course I understand that I need to write the whole container, this was
> > just en example (the ... was to illustrate that there was more information
> > there). I've added a container that looks exactly like one that works if I
> > do it directly in the httpd.conf (outside the <Perl></perl>).
>
> I hope you realize that we can't guess what you do. Can you show the relevant
> parts of httpd.conf and what you add for real?
>
> > Regarding the Tie::IxHash, it seems when I push in the hash into the
> > %VirtualHost, the order get's random again although it seems good in the
> > original hash.
>
> Again, please show us a short real code. There are many ways to 'push' things.
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
> --
> Report problems: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html
>

--
Stefan Cars
Snowfall Communications
Tel: +46 (0)18 430 80 50 - Direct: +46 (0)18 430 80 51
Mobile: +46 (0)708 44 36 00 - Fax: +46 (0)708 44 36 04



______________________________________________________________________
SNOWFALL DISCLAIMER:
The information contained in this email and in any
attachments is confidential and may be privileged. If you are not the
intended recipient, please destroy this message and notify the sender
immediately. You should not retain, copy or use this email for any
purpose, nor disclose all or any part of its content to any other person.
Any views expressed in this message are those of the individual sender,
except where the sender specifically states them to be the views of
Snowfall Communications.

Snowfall Communications monitors the content of emails sent and received
via its network for unauthorised use and for other lawful business
purposes. The contents of an attachment to this email may contain viruses
which could damage your computer system. While Snowfall Communications has
taken every reasonable precaution to minimise this risk, we cannot accept
liability for any damage which you sustain as a result of software
viruses. You should carry out your own virus checks before opening the
attachment.

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: and

Posted by Stas Bekman <st...@stason.org>.
Stefan Cars wrote:
> Hi!
> 
> Of course I understand that I need to write the whole container, this was
> just en example (the ... was to illustrate that there was more information
> there). I've added a container that looks exactly like one that works if I
> do it directly in the httpd.conf (outside the <Perl></perl>).

I hope you realize that we can't guess what you do. Can you show the relevant 
parts of httpd.conf and what you add for real?

> Regarding the Tie::IxHash, it seems when I push in the hash into the
> %VirtualHost, the order get's random again although it seems good in the
> original hash.

Again, please show us a short real code. There are many ways to 'push' things.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: and

Posted by Stefan Cars <st...@snowfall.se>.
Hi!

Of course I understand that I need to write the whole container, this was
just en example (the ... was to illustrate that there was more information
there). I've added a container that looks exactly like one that works if I
do it directly in the httpd.conf (outside the <Perl></perl>).

Regarding the Tie::IxHash, it seems when I push in the hash into the
%VirtualHost, the order get's random again although it seems good in the
original hash.

Kind Regards,
Stefan Cars



On Sat, 14 Feb 2004, Stas Bekman wrote:

> Stefan Cars wrote:
> > Hi!
> >
> > I'm having trouble getting doing some perl configuration within
> > <Perl></Perl> in httpd.conf with Apache 2 and mod_perl 2 (both latest
> > version as of today). Using this do not work:
> >
> > use Apache::DBI;
> > use Snowfall::Database3;
> > use Apache::PerlSections ();
> > use Apache::ServerUtil ();
> > use Apache::Server;
> > my $s = Apache->server;
> > ....
> > $s->add_config("<VirtualHost x.x.x.x>");
> > ...
> >
> >
> > But this doesn't work, it still says that "namevirtualhost x.x.x.x does
> > not have any virtualhosts".
>
> Since you need to add the whole vhost container at once I believe. Not just
> the opening <V...>
>
> > I have tried to go the "real" way of using $VirtualHost{'213....'} but the
> > problem occurs when I have to use RewriteRule etc, and want to have the
> > entries come out the same way they came into the hash (and using
> > Tie::IxHash isn't really working very well).
>
> What doesn't work about Tie::IxHash? Perhaps we should add a test using it.
>
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>
> --
> Report problems: http://perl.apache.org/bugs/
> Mail list info: http://perl.apache.org/maillist/modperl.html
> List etiquette: http://perl.apache.org/maillist/email-etiquette.html
>


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Re: and

Posted by Stas Bekman <st...@stason.org>.
Stefan Cars wrote:
> Hi!
> 
> I'm having trouble getting doing some perl configuration within
> <Perl></Perl> in httpd.conf with Apache 2 and mod_perl 2 (both latest
> version as of today). Using this do not work:
> 
> use Apache::DBI;
> use Snowfall::Database3;
> use Apache::PerlSections ();
> use Apache::ServerUtil ();
> use Apache::Server;
> my $s = Apache->server;
> ....
> $s->add_config("<VirtualHost x.x.x.x>");
> ...
> 
> 
> But this doesn't work, it still says that "namevirtualhost x.x.x.x does
> not have any virtualhosts".

Since you need to add the whole vhost container at once I believe. Not just 
the opening <V...>

> I have tried to go the "real" way of using $VirtualHost{'213....'} but the
> problem occurs when I have to use RewriteRule etc, and want to have the
> entries come out the same way they came into the hash (and using
> Tie::IxHash isn't really working very well).

What doesn't work about Tie::IxHash? Perhaps we should add a test using it.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html