Re: startup for Apache 2.0/mod_perl 1.99

2002-04-24 Thread Per Einar Ellefsen

At 19:31 24.04.2002, Chuck Goehring wrote:
>That made it work!  Your my hero!.  That also made the script that accesses
>Oracle work as well.  We've staved off the IIS beast for another day!

Great!

>I'm not familiar with the testing stuff except when Doug had me run the
>t/report thing..  I'm a CGI guy rather that an apache handler/C language
>type.

What he meant is that the test scripts in t/ contain many examples of 
mod_perl 2.0 configuration and use. Look at the *.pm files which show 
various handlers being used. That should give you an idea of what to do.


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: startup for Apache 2.0/mod_perl 1.99

2002-04-24 Thread Chuck Goehring

Stas,

That made it work!  Your my hero!.  That also made the script that accesses
Oracle work as well.  We've staved off the IIS beast for another day!

I'm not familiar with the testing stuff except when Doug had me run the
t/report thing..  I'm a CGI guy rather that an apache handler/C language
type.

The 250 was the built-in default value.  I  hadn't set anything related to
threads because I haven't read any of that yet.  Just trying to get things
basically working.  The high memory consumption and sluggish response may
have been aggravated by the missing directive and this machine only has
128MB memory.  It's running on my workstation that has many applications
open all the time.

Thanks for the help.

Chuck

- Original Message -
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: "Chuck Goehring" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 23, 2002 8:53 PM
Subject: Re: startup for Apache 2.0/mod_perl 1.99


> Chuck Goehring wrote:
> > You're right.  I'm getting impatient and jumping ahead.  Pasted directly
> > from your post, restarted Apache and get same thing
> >
> > [Tue Apr 23 12:16:54 2002] [notice] Parent: Created child process 2560
> > [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Child process is running
> > [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Acquired the start
mutex.
> > [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Starting 250 worker
threads.
> > [Tue Apr 23 12:17:46 2002] [error] 2560: ModPerl::Registry: `Can't call
> > method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line
433.
> >
> > It is referring to the IF statement:
> >if ($MOD_PERL) {
> >$query_string = Apache->request->args;
> >} else {
> >$query_string = $ENV{'QUERY_STRING'} if defined
$ENV{'QUERY_STRING'};
> >$query_string ||= $ENV{'REDIRECT_QUERY_STRING'} if defined
> > $ENV{'REDIRECT_QUERY_STRING'};
> >}
> I know what was missing.
>
> add 'PerlOptions +GlobalRequest', like so:
>
> 
>SetHandler perl-script
>PerlResponseHandler ModPerl::Registry
>Options ExecCGI
>PerlSendHeader On
>PerlOptions +GlobalRequest
> 
>
>
http://perl.apache.org/preview/modperl-docs/dst_html/docs/2.0/user/config/co
nfig.html#PerlOptions_Directive
> # GlobalRequest
> Setup the global request_rec for use with Apache->request
>
> Sorry for missing this one, I'm not used to it yet :)
>
> Also I'd like to repeat that the 2.0 test suite is the best place to
> learn how, before the docs will be completed.
>
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: startup for Apache 2.0/mod_perl 1.99

2002-04-24 Thread Per Einar Ellefsen

At 05:55 24.04.2002, Stas Bekman wrote:
>Chuck Goehring wrote:
>>Stas/Everyone,
>>To follow up.  With the starting and stopping of Apache and looking at the
>>log, I see entries like "Child 1032: Waiting for 250 worker threads to
>>exit."  I was gettiong "Low virtual memory" errors from Win/2000, so I added
>>ThreadsPerChild 24 to the http.conf.  This makes it stop quicker and use a
>>whole lot less memory.  Also, the error at the browser comes back faster.
>
>Why did you have it set to 250 in first place? For testing set it to just 
>a few
>to have the minimal overhead.

The default (on Win32 Apache anyways) is 250. So it's what people will 
usually keep if they don't know about it. Maybe a note in the docs?


-- 
Per Einar Ellefsen
[EMAIL PROTECTED]





Re: startup for Apache 2.0/mod_perl 1.99

2002-04-23 Thread Stas Bekman

Chuck Goehring wrote:
> Stas/Everyone,
> 
> To follow up.  With the starting and stopping of Apache and looking at the
> log, I see entries like "Child 1032: Waiting for 250 worker threads to
> exit."  I was gettiong "Low virtual memory" errors from Win/2000, so I added
> ThreadsPerChild 24 to the http.conf.  This makes it stop quicker and use a
> whole lot less memory.  Also, the error at the browser comes back faster.

Why did you have it set to 250 in first place? For testing set it to 
just a few
to have the minimal overhead.
__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: startup for Apache 2.0/mod_perl 1.99

2002-04-23 Thread Stas Bekman

Chuck Goehring wrote:
> You're right.  I'm getting impatient and jumping ahead.  Pasted directly
> from your post, restarted Apache and get same thing
> 
> [Tue Apr 23 12:16:54 2002] [notice] Parent: Created child process 2560
> [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Child process is running
> [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Acquired the start mutex.
> [Tue Apr 23 12:16:58 2002] [notice] Child 2560: Starting 250 worker threads.
> [Tue Apr 23 12:17:46 2002] [error] 2560: ModPerl::Registry: `Can't call
> method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433.
> 
> It is referring to the IF statement:
>if ($MOD_PERL) {
>$query_string = Apache->request->args;
>} else {
>$query_string = $ENV{'QUERY_STRING'} if defined $ENV{'QUERY_STRING'};
>$query_string ||= $ENV{'REDIRECT_QUERY_STRING'} if defined
> $ENV{'REDIRECT_QUERY_STRING'};
>}
I know what was missing.

add 'PerlOptions +GlobalRequest', like so:


   SetHandler perl-script
   PerlResponseHandler ModPerl::Registry
   Options ExecCGI
   PerlSendHeader On
   PerlOptions +GlobalRequest


http://perl.apache.org/preview/modperl-docs/dst_html/docs/2.0/user/config/config.html#PerlOptions_Directive
# GlobalRequest
Setup the global request_rec for use with Apache->request

Sorry for missing this one, I'm not used to it yet :)

Also I'd like to repeat that the 2.0 test suite is the best place to 
learn how, before the docs will be completed.

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: startup for Apache 2.0/mod_perl 1.99

2002-04-23 Thread Chuck Goehring

Stas/Everyone,

To follow up.  With the starting and stopping of Apache and looking at the
log, I see entries like "Child 1032: Waiting for 250 worker threads to
exit."  I was gettiong "Low virtual memory" errors from Win/2000, so I added
ThreadsPerChild 24 to the http.conf.  This makes it stop quicker and use a
whole lot less memory.  Also, the error at the browser comes back faster.

I added use "Apache::compat;" to the test program after "use
ModPerl::Registry;" hoping it would stop it from complaining about CGI.pm.
But, I still get Error 500 in the browser and "[error] 2724:
ModPerl::Registry: `Can't call method "args" on an undefined value at
c:/perl/5.6.1/lib/CGI.pm line 433." in the log.

The build I'm using is modperl-2.0_2002042700.tar.gz.

I tried adding PerlModule Apache2 to http.conf  right after "LoadModule
perl_module modules/mod_perl.so" and I get a "Application Error/memory could
not be read".  The same CGI.pm error appears in the log.

Also, the CGI.pm I have is dated 03/03/2001 and came with perl 5.6.1.

Thanks
Chuck



- Original Message -
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: "Chuck Goehring" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 23, 2002 11:12 AM
Subject: Re: startup for Apache 2.0/mod_perl 1.99


> Chuck Goehring wrote:
> > Stas,
> > First, there was no mod_perl 1.2x installed on this machine.  I didn't
think
> > I would need it, but I'm guessing.
> >
> > This was as you say.  The  didn't aggree with the
registry
> > loaded in startup.  That fixed that problem but now it complains about
> > CGI.pm as follows:
> >
> > [Tue Apr 23 10:10:00 2002] [error] 2676: ModPerl::Registry: `Can't call
> > method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line
433.
>
> It's a very bad idea to try to find the problem without reducing the
> setup to a bare minimum.
>
> Does the very basic setup work for you? If it does, start from here and
> add things till you hit the problem.
>
> httpd.conf:
> ---
> LoadModule perl_module modules/mod_perl.so
> Alias /perl e:/Apache2/cgi-perl
> PerlRequire e:\apache2\conf\startup.cgi
>
> 
>SetHandler perl-script
>PerlResponseHandler ModPerl::Registry
>Options ExecCGI
>PerlSendHeader On
> 
>
> startup.pl:
> ---
> #! /perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w
>
> use strict;
> use Apache2 ();
> use Apache::compat;
>
> and a test script:
> #! c:/perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w
> use ModPerl::Registry;
> use CGI;
>
> $q = new CGI;
>
> print $q->header,
>$q->start_html(),
>'Hello',
>$q->end_html();
>
>
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>




Re: startup for Apache 2.0/mod_perl 1.99

2002-04-23 Thread Chuck Goehring


You're right.  I'm getting impatient and jumping ahead.  Pasted directly
from your post, restarted Apache and get same thing

[Tue Apr 23 12:16:54 2002] [notice] Parent: Created child process 2560
[Tue Apr 23 12:16:58 2002] [notice] Child 2560: Child process is running
[Tue Apr 23 12:16:58 2002] [notice] Child 2560: Acquired the start mutex.
[Tue Apr 23 12:16:58 2002] [notice] Child 2560: Starting 250 worker threads.
[Tue Apr 23 12:17:46 2002] [error] 2560: ModPerl::Registry: `Can't call
method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433.

It is referring to the IF statement:
   if ($MOD_PERL) {
   $query_string = Apache->request->args;
   } else {
   $query_string = $ENV{'QUERY_STRING'} if defined $ENV{'QUERY_STRING'};
   $query_string ||= $ENV{'REDIRECT_QUERY_STRING'} if defined
$ENV{'REDIRECT_QUERY_STRING'};
   }

In CGI>pm up at line 148 there is this:
# Turn on special checking for Doug MacEachern's modperl
if (exists $ENV{'GATEWAY_INTERFACE'}
&&
($MOD_PERL = $ENV{'GATEWAY_INTERFACE'} =~ /^CGI-Perl\//))
{
$| = 1;
require Apache;
}

Do I need to define 'GATEWAY_INTERFACE', or is it provided automatically by
mod_perl? This is on Win2000.

Thanks
Chuck


- Original Message -
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: "Chuck Goehring" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 23, 2002 11:12 AM
Subject: Re: startup for Apache 2.0/mod_perl 1.99


> Chuck Goehring wrote:
> > Stas,
> > First, there was no mod_perl 1.2x installed on this machine.  I didn't
think
> > I would need it, but I'm guessing.
> >
> > This was as you say.  The  didn't aggree with the
registry
> > loaded in startup.  That fixed that problem but now it complains about
> > CGI.pm as follows:
> >
> > [Tue Apr 23 10:10:00 2002] [error] 2676: ModPerl::Registry: `Can't call
> > method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line
433.
>
> It's a very bad idea to try to find the problem without reducing the
> setup to a bare minimum.
>
> Does the very basic setup work for you? If it does, start from here and
> add things till you hit the problem.
>
> httpd.conf:
> ---
> LoadModule perl_module modules/mod_perl.so
> Alias /perl e:/Apache2/cgi-perl
> PerlRequire e:\apache2\conf\startup.cgi
>
> 
>SetHandler perl-script
>PerlResponseHandler ModPerl::Registry
>Options ExecCGI
>PerlSendHeader On
> 
>
> startup.pl:
> ---
> #! /perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w
>
> use strict;
> use Apache2 ();
> use Apache::compat;
>
> and a test script:
> #! c:/perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w
> use ModPerl::Registry;
> use CGI;
>
> $q = new CGI;
>
> print $q->header,
>$q->start_html(),
>'Hello',
>$q->end_html();
>
>
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
>




Re: startup for Apache 2.0/mod_perl 1.99

2002-04-23 Thread Stas Bekman

Chuck Goehring wrote:
> Stas,
> First, there was no mod_perl 1.2x installed on this machine.  I didn't think
> I would need it, but I'm guessing.
> 
> This was as you say.  The  didn't aggree with the registry
> loaded in startup.  That fixed that problem but now it complains about
> CGI.pm as follows:
> 
> [Tue Apr 23 10:10:00 2002] [error] 2676: ModPerl::Registry: `Can't call
> method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433.

It's a very bad idea to try to find the problem without reducing the 
setup to a bare minimum.

Does the very basic setup work for you? If it does, start from here and 
add things till you hit the problem.

httpd.conf:
---
LoadModule perl_module modules/mod_perl.so
Alias /perl e:/Apache2/cgi-perl
PerlRequire e:\apache2\conf\startup.cgi


   SetHandler perl-script
   PerlResponseHandler ModPerl::Registry
   Options ExecCGI
   PerlSendHeader On


startup.pl:
---
#! /perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w

use strict;
use Apache2 ();
use Apache::compat;

and a test script:
#! c:/perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w
use ModPerl::Registry;
use CGI;

$q = new CGI;

print $q->header,
   $q->start_html(),
   'Hello',
   $q->end_html();


__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com





Re: startup for Apache 2.0/mod_perl 1.99

2002-04-23 Thread Chuck Goehring

Stas,
First, there was no mod_perl 1.2x installed on this machine.  I didn't think
I would need it, but I'm guessing.

This was as you say.  The  didn't aggree with the registry
loaded in startup.  That fixed that problem but now it complains about
CGI.pm as follows:

[Tue Apr 23 10:10:00 2002] [error] 2676: ModPerl::Registry: `Can't call
method "args" on an undefined value at c:/perl/5.6.1/lib/CGI.pm line 433.

As you suggested, the use Apache::compat; is in startup.  It had no effect.

Here is location in http.conf
LoadModule perl_module modules/mod_perl.so
Alias /perl e:/Apache2/cgi-perl
PerlRequire e:\apache2\conf\startup.cgi

# Access.conf

  # Below for .js files
  AllowOverride FileInfo
  # Below changed from Set to Add to accomodate .js files
  # Vaguely recall some problem on newsgroups but?
  # don't use this one SetHandler perl-script
  AddHandler perl-script .cgi
  #PerlHandler Apache::Registry
  PerlHandler ModPerl::Registry
  PerlResponseHandler ModPerl::Registry
  Options ExecCGI
  allow from 206.128.139
  PerlSendHeader On


==> Here is startup.cgi
#! /perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w

use strict;
#use Apache ();
use Apache2 ();
use Apache::compat;
use ModPerl::Registry;
use DBI();
use CGI qw(-compile :cgi);
use Carp();

use DBI();
use CGI qw(-compile :cgi);

1;
__END__

===> Here's the test program:
#! c:/perl/5.6.1/bin/MSWin32-x86-multi-thread/perl.exe -w
use Apache2 ();
use Apache::compat;
use ModPerl::Registry;#  use Apache::Registry;

use CGI qw/:standard :html3/;
use CGI::Carp qw(fatalsToBrowser);
use DBI(); # use Apache::DBI();
$cgiOBJ = new CGI;

$dataSource = "dbi:Oracle:dis.world"; # put your DSN here
$dataSource = "dbi:Oracle:rciora"; # put your DSN here
$userName   = 'terminals'; # you know what goes here
$password   = ''; # and here
$dbh = DBI->connect($dataSource, $userName, $password)
or die $DBI::errstr;

print $cgiOBJ->header(-expires=>'-1d'),
  $cgiOBJ->start_html(-TITLE=>'oracle test.pl',
  -BGCOLOR=>'#FF');

print "start here";
$sql = "SELECT * FROM terminals.assets where substr(asset_part_no,1,1) =
'B'";
$sth = $dbh->prepare($sql) || die $dbh->errstr;
$rc = $sth->execute || die  $sth->errstr;
while (($firstField, $anotherField) = $sth->fetchrow_array){
print "$firstField: $anotherField\n";
}
warn $DBI::errstr if $DBI::err;
$sth->finish;

$dbh->disconnect;

print "end here";

print $cgiOBJ->end_html;

Thanks for any input.

Chuck




- Original Message -
From: "Stas Bekman" <[EMAIL PROTECTED]>
To: "Chuck Goehring" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, April 22, 2002 7:26 PM
Subject: Re: startup for Apache 2.0/mod_perl 1.99


> Chuck Goehring wrote:
> > To all,
> >
> >
> >
> > Having trouble configuring Apache 2.0 with mod_perl.  Don't know if I
> > need compat or not.
> >
> >
> >
> > My Apache 1.x/mod_perl 1.24 startup starts like this:
> >
> >
> >
> > use strict;
> > use Apache ();
> > use Apache::Registry;
> > use Apache::DBI();
> > use CGI qw(-compile :cgi);
> > use Carp();
> >
> >
> >
> > That didn't fly on Apache 2.0.35/mod_perl 1.99 (snapshot).  Trying to
> > get something equivalent working.
>
> If you want to use the old registry, the above missing:
>
> use Apache2 ();
> use Apache::compat;
>
> > Below doesn't work with or without
> > Apache::compat.
> >
> >
> >
> > use strict;
> > use Apache2 ();
> > use Apache::compat;
> > use ModPerl::Registry;#  use Apache::Registry;
> >
> > #use Apache2::DBI();  # use Apache::DBI();
> > use DBI();
> > use CGI qw(-compile :cgi);
>
> looks good to me. You don't show your  config. Does it include
>
>SetHandler perl-script
>PerlResponseHandler ModPerl::Registry
>
> ??
>
> > Apache error log id like so (last line):
> >
> > [Mon Apr 22 18:00:58 2002] [error] failed to resolve handler
> > `Apache::Registry'
>
> Apache::Registry? Above you said you are using ModPerl::Registry. Check
> your config. I suggest to grep for Apache::Registry.
>
> Apache::DBI (for 2.0 wasn't ported yet, and available for those seeking
> interesting challenges)
>
> __
> Stas BekmanJAm_pH --> Just Another mod_perl Hacker
> http://stason.org/ mod_perl Guide ---> http://perl.apache.org
> mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: startup for Apache 2.0/mod_perl 1.99

2002-04-22 Thread Stas Bekman

Chuck Goehring wrote:
> To all,
> 
>  
> 
> Having trouble configuring Apache 2.0 with mod_perl.  Don't know if I 
> need compat or not. 
> 
>  
> 
> My Apache 1.x/mod_perl 1.24 startup starts like this:
> 
>  
> 
> use strict;
> use Apache ();
> use Apache::Registry;
> use Apache::DBI();
> use CGI qw(-compile :cgi);
> use Carp();
> 
>  
> 
> That didn't fly on Apache 2.0.35/mod_perl 1.99 (snapshot).  Trying to 
> get something equivalent working.  

If you want to use the old registry, the above missing:

use Apache2 ();
use Apache::compat;

> Below doesn't work with or without 
> Apache::compat. 
> 
>  
> 
> use strict;
> use Apache2 ();
> use Apache::compat;
> use ModPerl::Registry;#  use Apache::Registry;
> 
> #use Apache2::DBI();  # use Apache::DBI();
> use DBI();
> use CGI qw(-compile :cgi);

looks good to me. You don't show your  config. Does it include

   SetHandler perl-script
   PerlResponseHandler ModPerl::Registry

??

> Apache error log id like so (last line): 
>
> [Mon Apr 22 18:00:58 2002] [error] failed to resolve handler 
> `Apache::Registry'

Apache::Registry? Above you said you are using ModPerl::Registry. Check 
your config. I suggest to grep for Apache::Registry.

Apache::DBI (for 2.0 wasn't ported yet, and available for those seeking 
interesting challenges)

__
Stas BekmanJAm_pH --> Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com




Re: startup vs. child initialization question

2002-04-01 Thread Perrin Harkins

>> Also, I read about issues of database handlers becoming
>>unstable across forks.  So should I place this initialization
>>information into a perl child init handler?

See the connect_on_init() method in the Apache::DBI docs.

>We use PerlSetVar's for this where I work.

That's how I would do it too, for anything that might vary by virtual host.

- Perrin




Re: startup vs. child initialization question

2002-03-31 Thread Frank Wiles


On Sun, 31 Mar 2002 12:43:45 -0800 (PST) [EMAIL PROTECTED] wrote:

> Hi!  I had a question regarding where I should be placing global
> configuration options in mod_perl.  Here's the qweekie scenario:
> 
> I want to load a configuration file of various options (such as db
> arguments, system directories, db connections, etc.) into a hash or
> perl object global to Apache so that my mod_perl handlers have access
> to this variable/object, kinda like the %ENV variable except that I
> wish to keep these pieces of information separate from the %ENV
> variable.  Initially, I thought about loading this configuration
> information in a startup script and using the PerlRequire directive to
> load this script.  However, since doing this code will run under root
> privileges, would it be a good idea to place this type of information
> in this file?  Also, I read about issues of database handlers becoming
> unstable across forks.  So should I place this initialization
> information into a perl child init handler?
> 
> Second if I want to utilize virtual hosting on a single machine with
> mod_perl loaded into certain hosts, what would this situation do in
> terms of allowing those hosts to access these variables?  What should
> I do if I want a kind of separate configuration environment per
> virtual host in mod_perl and to load that configuration environment up
> before a request to improve performance?

   We use PerlSetVar's for this where I work.  It goes something like this: 

 
SetHandler perl-script
PerlHandler MyHandler::Foo
PerlSetVar DatabaseName foo
PerlSetVar DatabaseUser foouser
PerlSetVar DatabasePass foo$secret
 

In the code we grab these variables like so: 

sub handler { 
my $r = shift; 
my %vars = (); 

$vars{dbname} = $r->dir_config('DatabaseName'); 
$vars{dbuser} = $r->dir_config('DatabaseUser'); 
$vars{dbpass} = $r->dir_config('DatabasePass'); 
}

We actually have 10 or so common configuration parameters on most of
of our modules so we move all of our $r->dir_configs into an init() 
subroutine. 

Anyway... this might be one way to attack your problem, as you can 
then use different parameters on each virtual host. 

 -
   Frank Wiles <[EMAIL PROTECTED]>
   http://frank.wiles.org
 -




Re: startup

2001-06-27 Thread Stas Bekman

On Wed, 27 Jun 2001, Purcell, Scott wrote:

> Hello Stas,
> I think somehow my question got out of sync with the answer. My question
> was, if I do a use cgi qw(-compile: all) in my startup (which I have done),
> do I still need to put a use cgi in each of my .pl files? I have read
> through the docs, and the book, but as a rookie to mod-perl these kinds of
> questions are hard for me to get a handle on. I assume the answer is yes,
> but instead of actually reloading the module that it would check the cache
> and use that? Am I on the right track. Also, there is quite a bit of
> documentation out there, could you point me to the one that talks about
> this?

Scott, please keep the questions at the list, wheneven someone or I can
answer we will do it. You minimize your chances to get answered when you
try to do it in private.

As I said, the guide covers this question. Here is the direct URL:
http://perl.apache.org/guide/config.html#The_Confusion_with_use_in_the_

Here is a link to the notes in my previous reply to you:
http://perl.apache.org/guide/performance.html#Preloading_Perl_Modules_at_Serve


>
> I hope I am not offending you by asking,
> Sincerely
> Scott
>
> -Original Message-
> From: Stas Bekman [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, June 27, 2001 11:10 AM
> To: Purcell, Scott
> Cc: mod_perl list
> Subject: Re: Startup.pl File Q
>
>
> On Wed, 27 Jun 2001, Issac Goldstand wrote:
>
> > Actually, I believe that it helps to do a use cgi qw(-compile: all) as
> this
> > will pre-compile the entire module (which makes it go a bit faster for
> it's
> > first request).
>
> As Issac correctly said, but usually you don't want :all, but only the tag
> groups that you really need. Scott, please refer to the guide, it explain
> what, how and why.  Including memory measurement with different configs.
>
> >
> >Issac
> >
> > - Original Message -
> > From: "Purcell, Scott" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Wednesday, June 27, 2001 17:29
> > Subject: Startup.pl File Q
> >
> >
> > > Mod_perl version: 1.25_01-dev
> > > Perl version: 5.6.1
> > > Apache Version:  1.3.20
> > > OS:NT
> > >
> > > I am in the apache book and I am doing some hacking. In my startup.pl
> > file,
> > > I put 'use CG qw(:standard); along with some other modules.
> > > Anyway, then I typed that little dittie below, and commented out the
> $use
> > > CGI (since I thought it would be loaded in the startup.pl file).
> > >
> > > It does not work. Are the items in the startup.pl file only used with
> > > handlers?
> > >
> > > Thanks
> > > Scott
> > >
> > >
> > >
> > > ### code below just for reference #
> > >
> > > #! /usr/local/bin/perl
> > >
> > > #use CGI qw(:standard);
> > > use strict;
> > >
> > > my $name = param('name') || 'Anonymous';
> > >
> > > print header(),
> > > start_html(-title=>'Yo!',-bgcolor=>'blue'),
> > > h1("Hello $name"),
> > > p(
> > > "To change your name, enter it into the text field below and press",
> > > em("change name.")
> > > ),
> > > start_form(),
> > > "Name: ",textfield(-name=>'name',-value=>'Anonymous'),
> > > submit(-value=>'Change Name'),
> > > end_form(),
> > > hr(),
> > > end_html();
> > >
> > > Scott Purcell
> > >
> >
>
>
>
> _
> Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
> http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
> mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
> http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
>



_
Stas Bekman  JAm_pH --   Just Another mod_perl Hacker
http://stason.org/   mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/





Re: startup file

2000-07-24 Thread David Hodgkinson


Paul Phillips <[EMAIL PROTECTED]> writes:

> Hello, all,
> 
> I'm quite noew to modperl.  I've written a cgi, using cgi.pm that I am 
> moving to modperl.  The cgi is written as one main program, with a number 
> of subroutines spread across three libraries that are required into the 
> main program.
> 
> If I list the main program in my startup file, so it is loaded on server 
> startup, does it load the external libraries as well?

Yes. But you need to use Apache::RegistryLoader to load the script.

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -



Re: Startup file problem

2000-07-20 Thread G.W. Haywood

Hi there,

On Thu, 20 Jul 2000, Elie Nacache wrote:

> Why this strange behaviors ??
> 
> Can you help me !

Probably not unless you give more information.
Read SUPPORT.
Send copies of the relevant parts of the error log.
Send httpd.conf and any files referenced by it.

73,
Ged.




Re: Startup file and process size

2000-07-18 Thread Ajit Deshpande

On Tue, Jul 18, 2000 at 08:45:30AM -0700, Suresh wrote:
> the startup file, the size of all the process becomes big. I excpected 
> that only the apache's parent process size becomes become. Also when i 
> ran the example given in the mod_perl guide , to see the difference in 
> the shared memory size, its same with or without a startup file. 

Read:

http://perl.apache.org/guide/performance.html#Calculating_Real_Memory_Usage

Ajit



Re: Startup file and process size

2000-07-18 Thread David Hodgkinson


Suresh <[EMAIL PROTECTED]> writes:

> Hi all,
> 
> I am trying use a startup file to load all the used modules in my web application, 
>but when i use
> the startup file, the size of all the process becomes big. I excpected that only the 
>apache's
> parent process size becomes become. Also when i ran the example given in the 
>mod_perl guide , to
> see the difference in the shared memory size, its same with or without a startup 
>file. 

Which? The parent Apache or the daughters?

Are you positive your startup is getting executed?

-- 
Dave Hodgkinson, http://www.hodgkinson.org
Editor-in-chief, The Highway Star   http://www.deep-purple.com
  Apache, mod_perl, MySQL, Sybase hired gun for, well, hire
  -