Re: Upload/POST fails repeatedly with mod_perl 1.29 and 1.27

2004-11-17 Thread Raphael Ferguson


Thank you much for the quick response.

I tried setting the TMPDIR in startup.pl and in httpd.conf to no avail.  The "[libapreq] file upload forbidden" error message is almost certainly coming from ibapreq's apache_request.c, line 591:

if (req->disable_uploads) {
ap_log_rerror(REQ_ERROR, "[libapreq] file upload forbidden");
return HTTP_FORBIDDEN;
}

I just have no clue why req->disable_uploads is apparently returning true no matter what I do to make sure uploads are enabled.

<-Original Message-> 
From: Stas Bekman

>Smells like either a disk space shortage problem. Or inability to find the 
>TMP directory. Try defining TMPDIR env var before starting the server and 
>see if it makes any difference.



Re: PerlRequire script starts two times - how to avoid this

2004-11-17 Thread Stas Bekman
Marcin Kosewski wrote:
Hi Gurus,
I'm using Apache 1.3.33 with mod_perl 1.29. In Apache httpd.conf file I'm
loading external perl directives using:
PerlRequire startup.pl
I've checked, that during apache startup 'startup.pl' runs two times. And
I want, that this script runs only once (because I'm allocating there
shared memory areas for later use).
So, question is: how to force Apache to run this script exactly once during
startup.
http://perl.apache.org/docs/1.0/guide/config.html#Apache_Restarts_Twice_On_Start
--
__
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
--
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


PerlRequire script starts two times - how to avoid this

2004-11-17 Thread Marcin Kosewski
Hi Gurus,

I'm using Apache 1.3.33 with mod_perl 1.29. In Apache httpd.conf file I'm
loading external perl directives using:
PerlRequire startup.pl

I've checked, that during apache startup 'startup.pl' runs two times. And
I want, that this script runs only once (because I'm allocating there
shared memory areas for later use).

So, question is: how to force Apache to run this script exactly once during
startup.

In my other servers with previous versions of Apache and mod_perl I've used
in startup script directive:
  return 1 if ( getppid() != 1 );
and it solved the problem - commands after this one were executed only
once. But now it doesn't work.


I've tried this in startup.pl:
  WriteToDebugFile( "begin, getppid=".getppid()." getpid=".$$." );
  return 1 if ( getppid() != 1 );
  WriteToDebugFile( "Done" );

And after apache run i've found in debug-file this:
  begin, getppid=1005 getpid=1006
  begin, getppid=1005 getpid=1006


I've checked pid's of starting Apache processes:
1. I've started Apache:
  sh /www/apache_1.3.33/bin/apachectl start 
  (Pid: 1005, Parent: 1004)
2. One process was started
  /www/apache_1.3.33/bin/httpd -f /www/conf/httpd.conf 
  (Pid: 1006, Parent: 1005)
3. After some time (and executing TWO times startup.pl) apache was ready:
   /www/apache_1.3.33/bin/httpd -f /www/conf/httpd.conf
   (Pid:1009, Parent: 1)
   /www/apache_1.3.33/bin/httpd -f /www/conf/httpd.conf
   (Pid: 1012, Parent 1009)
   .
   .
   .
   (other workers)


-- 
 | Marcin Kosewski
 | [EMAIL PROTECTED]
-+
 |

-- 
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: Internal Server Error on perl.apache.org

2004-11-17 Thread Stas Bekman
Arshavir Grigorian wrote:
Hello list,
I just tried searching for 'path_info' in the 2.0 docs and got an 
internal server error(500).

http://perl.apache.org/search/swish.cgi?query=path_info&sbm=SecI&submit=search 
The /x1/log/www/error_log says:
[Wed Nov 17 15:01:50 2004] [error] [client 65.92.240.155] Out of memory!
[Wed Nov 17 15:01:50 2004] [error] [client 65.92.240.155] Premature end of 
script headers: swish.cgi

Is something wrong with minotaur.apache.org?
or does this have anything to do with the recent infrastructure changes?
--
__
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
--
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


Internal Server Error on perl.apache.org

2004-11-17 Thread Arshavir Grigorian
Hello list,
I just tried searching for 'path_info' in the 2.0 docs and got an 
internal server error(500).

http://perl.apache.org/search/swish.cgi?query=path_info&sbm=SecI&submit=search
Hope it's easy to fix.
Best, Arshavir
--
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: read not sysread?

2004-11-17 Thread Stas Bekman
Sean T Allen wrote:
using 1.99_17...
moved code to a new machine that i built as compared to a pre-existing 
machine running... 1.99_07-dev

i have a stripped down CGI reading routine...
   eval ( "sysread( \STDIN, \$input, $ENV{ 'CONTENT_LENGTH' } )" );
CGI.pm uses read, not sysread. Where did you find sysread in it? Which 
version are you using. (and in the future please follow the guidelines on 
problems report: http://perl.apache.org/bugs/ so we don't have to ask the 
same questions again and again)

doesnt read anything
but
   read( STDIN, $input, $ENV{ 'CONTENT_LENGTH' } );
does
there is a warning in the error log for the line that the eval is on:
Unrecognized escape \S passed through at /ai/toppik/lib/Infant/CGI.pm 
line 484.

any quick help on fixing this problem is appreciated. or actually just 
an explaination...
under mod_perl STDIN is tied *only* if run under 'perl-script'
http://perl.apache.org/docs/2.0/user/config/config.html#C_perl_script_
and then you can read() from it.
perl's tie interface doesn't support SYSREAD (see perltie.pod), so you 
can't use sysread under mod_perl.

--
__
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
--
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: multiple instances of one web application

2004-11-17 Thread perrin
> thanks for the info, might be a bit much afford.

Not at all -- you can run them all on a single machine.  There should be
no extra cost to this approach except a bit more setup work.

> do you know any way to put some placeholders inside the perl code that
> will be replaced before compilation?

There are various pre-processors you could use, just like you would with C.

- Perrin


-- 
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: Advice needed on custom webapp framework

2004-11-17 Thread Jonathan Vanasco
I'm pretty damn sure you did get that right!
That would do EXACTLY what i want it to do!
I'm gonna play around with that approach when i get home tonight.  
Thanks!

On Nov 17, 2004, at 2:26 PM, Tom Schindl wrote:
What you really need here when talking about Pattern-Programming is a 
"Factory-Class" which creates the
appropiate WebAppFramework::DBI-Sub-Class for you and design all your 
Website*::DBI-classes as "Singletons".

Hope I got you right? If you don't want to use config values you could 
also use the name of the package
in the handler e.g. Website1, Website2 and add "::DBI" in your factory 
method.

--
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: Advice needed on custom webapp framework

2004-11-17 Thread Tom Schindl
Jonathan Vanasco wrote:
package Website1;
my  $DB = new Website1::DB();
# make a new ref for the website
sub handler
{
my $r = shift;
my $user = new Website::User( \$r, \$DB );
 my $page = new Website::Page( \$user , \$DB );
my $html = $page->processRequest();
}
what i would like is:
sub handler
{
my $r = shift;
my $user = new Website::User( \$r );
 my $page = new Website::Page( \$user );
my $html = $page->processRequest();
}
now, i guess what i'm trying to do within
Website1::User
Website1::Page
is access the
$DB in the base of Website1 that i define just before the handler
BUT
I'm trying to do so in a way that both:
Website1::PackageName
Website2::PackageName
WebAppFramework::PackageName
Will all retreive the correct DB from the script that defines the 
handler

Ok. This means you want to make your Website::User and Website::Page 
more intelligent. If I got you right the only thing have to implement
for each user is Website1::DBI and Website2::DBI.

What you really need here when talking about Pattern-Programming is a 
"Factory-Class" which creates the
appropiate WebAppFramework::DBI-Sub-Class for you and design all your 
Website*::DBI-classes as "Singletons".

===8<===
package WebAppFramework::DBIFactory;
sub getDb {
   my $dbiModule = shift;
   require($dbiModule); ## load the apprioate module
   return $dbiModule->instance(); ## get an instance of the module
}
1;
===8<===
===8<===
package WebAppFramework::User;
sub new {
   my $class = shift;
   my $r = shift;
   my $this =
   {
  db => 
WebAppFramework::DBIFactory::getDb($r->dir_config("DBIModule"));
   };

   bless $this, $class;
}
1;
===8<===
===8<===

   PerlSetVar DBIModule Website1::DBI


   PerlSetVar DBIModule Website2::DBI

===8<===
Hope I got you right? If you don't want to use config values you could 
also use the name of the package
in the handler e.g. Website1, Website2 and add "::DBI" in your factory 
method.

Tom
--
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: Advice needed on custom webapp framework

2004-11-17 Thread Jonathan Vanasco
Because i'm an idiot and didn't realize that I was doing that!
I'm just used to passing refs everywhere.  to get into the whole 'No 
More passing large vars around' thing, i just stopped passing 
everything but a ref

Silly me!
On Nov 17, 2004, at 1:25 PM, Tom Schindl wrote:
I don't answer your questions but why are you passing all objects by 
reference. An object is already a reference (normally Hash or Scalar)
and it does not improve your memory usage it only decreases your 
performance because you always have to dereference it.

--
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: Advice needed on custom webapp framework

2004-11-17 Thread Tom Schindl
jonathan vanasco wrote:
I built for mod_perl1 a customer webapp framework
It functions as 2 perl modules/package sets
/lib/WebAppFramework
/lib/Website
For each website/webapp, i make a new /lib/Website that subclasses the 
WebAppFramework (which handles users, email, webpage generation, etc 
-- and makes heavy use of cpan modules -- i just wanted a way to find 
a lowest-common-denominator to interface with multiple packages, so i 
can rapidly prototype webapps)

It worked really well for everything I want it to do -- super simple 
and easy to build and add functions.

except - its a little messy
The idea I wanted to implement, is essentially this handler:
my  $DB = new Website::DB();
sub handler {
DEBUG >0 && print STDERR " NEW 
REQUEST\n\n";
my $r = shift;
my $user = new Website::User( \$r, \$DB );
 my $page = new Website::Page( \$user , \$DB );
my $html = $page->processRequest();
$r->content_type('text/html');
$r->print( $html );
return OK;
}

I don't answer your questions but why are you passing all objects by 
reference. An object is already a reference (normally Hash or Scalar)
and it does not improve your memory usage it only decreases your 
performance because you always have to dereference it.

The idea, is that any page is just a view to a user (logged in or 
not), so is rendered to that person.

Now, this is my issue -- I'm creating a user AND a page with a ref to 
the DB handle - which is wasteful. And requires a lot of extra typing 
on my part.

Ideally, I would have the packages  in Website and WebAppFramework 
lookup the right DB for the Website

I can't figure out how to do this in a coherent way though.
Any  advice would be excellent.


--
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


read not sysread?

2004-11-17 Thread Sean T Allen
using 1.99_17...
moved code to a new machine that i built as compared to a pre-existing 
machine running... 1.99_07-dev

i have a stripped down CGI reading routine...
   eval ( "sysread( \STDIN, \$input, $ENV{ 'CONTENT_LENGTH' } )" );
doesnt read anything
but
   read( STDIN, $input, $ENV{ 'CONTENT_LENGTH' } );
does
there is a warning in the error log for the line that the eval is on:
Unrecognized escape \S passed through at /ai/toppik/lib/Infant/CGI.pm 
line 484.

any quick help on fixing this problem is appreciated. or actually just 
an explaination...

if i had built the preeceeding server i could probably track down why it 
works there
and not here... but i didn't so... any pointers re what is the right 
direction to look
are greatly appreciated.


begin:vcard
fn:Sean T. Allen
n:Allen;Sean T.
org:USA Herbals, LLC
email;internet:[EMAIL PROTECTED]
title:Tech Guru
tel;work:718-388-5424
x-mozilla-html:FALSE
version:2.1
end:vcard


-- 
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: Advice needed on custom webapp framework

2004-11-17 Thread Jonathan Vanasco
Thanks!
Right now, I should have been more clear, though -- I'm am kinda doing 
a bit of each approach you mentioned -- but i am in need of a little 
more help.

I think what i want is more of your second approach right now...
 Let me elaborate for a moment
WebAppFramework::DB.pm
Base Class
Users Apache:DBI
Package handles all DB abstraction and connections
Website1::DB.pm
SubClass of WebAppFramework::DBI.pm
Package has configuration information (host/port/user/pass/etc)
Website2::DB.pm
	SubClass of WebAppFramework::DBI.pm
	Package has configuration information (host/port/user/pass/etc)
	Website1/Website2 are different package directories that subclass the 
framework
	I'm showing Website1/Website2 just to illustrate the namespace

In the example on my last post, my handle does this:
package Website1;
my  $DB = new Website1::DB();
# make a new ref for the website
sub handler
{
my  $r  = shift;
my  $user   = new Website::User( \$r, \$DB );
my  $page   = new Website::Page( \$user , \$DB );
my  $html   = $page->processRequest();
}
what i would like is:
sub handler
{
my  $r  = shift;
my  $user   = new Website::User( \$r );
my  $page   = new Website::Page( \$user );
my  $html   = $page->processRequest();
}
now, i guess what i'm trying to do within
	Website1::User
	Website1::Page
is access the
	$DB in the base of Website1 that i define just before the handler
BUT
	I'm trying to do so in a way that both:
		Website1::PackageName
		Website2::PackageName
		WebAppFramework::PackageName
	Will all retreive the correct DB from the script that defines the 
handler

I've tried this a few different ways, but I've often ended up reading  
WebAppFramework::$DB instead of Website1::$DB
I guess I'm trying to figure out a way for the baseclasses to access 
information in the subclasses - which sounds wrong, stupid and 
impossible.

Does that make more sense?  Does your suggestion still apply?
Sorry, I'm just very confused by all this myself, and I fear that i'm 
not asking the right questions.


On Nov 17, 2004, at 12:11 PM, Michael Schout wrote:
There are many ways to solve this problem.  I'll show you 2 ways.  I'll
focus just on the database part to keep this as short as possible, but
the same ideas apply to the user object...

--
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: Advice needed on custom webapp framework

2004-11-17 Thread Michael Schout
On Wed, 17 Nov 2004, jonathan vanasco wrote:

> Ideally, I would have the packages  in Website and WebAppFramework
> lookup the right DB for the Website

There are many ways to solve this problem.  I'll show you 2 ways.  I'll
focus just on the database part to keep this as short as possible, but
the same ideas apply to the user object...

One way is to put the databse in a separate package and access it
using static methods.

e.g.:

my $dbh = Website::Database->dbh;

You could even make this a method of WebAppFramework.  Then you are
simply left with the problem of getting the right database handle for
each website.  There are many ways to do that.  One way would be to just
have a hash or something in WebAppFramework that stores the database
handles for each partuclar website, and then have your dbh() (or
whatever you decide to call it) method figure out which handle to
retrieve.  The downside is that you have to modify WebAppFramework
everytime you create a new application (or, create methods for managing
the datbase hash, and call them from within your appliaction). If you
don't want to do it that way, another way would be to simply subclass
WebAppFramework for each site, and then have the individual appliactions
subclass it.  e.g.:

package WebAppFrameWork::SomeSite;

use base 'WebAppFrameWork';

sub dbh {
# return database appropriate for "SomeSite"
}
...
__END__

package WebApp::SomeSite::SomeApp;

use base 'WebAppFrameWork::SomeSite';

# calling $self->dbh in here calls WebAppFrameWork::SomeSite->dbh
# plus you can call any methods provided by WebAppFrameWork
...

__END__

Regards,
Michael Schout

-- 
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



Advice needed on custom webapp framework

2004-11-17 Thread jonathan vanasco
I built for mod_perl1 a customer webapp framework
It functions as 2 perl modules/package sets
/lib/WebAppFramework
/lib/Website
For each website/webapp, i make a new /lib/Website that subclasses the 
WebAppFramework (which handles users, email, webpage generation, etc -- 
and makes heavy use of cpan modules -- i just wanted a way to find a 
lowest-common-denominator to interface with multiple packages, so i can 
rapidly prototype webapps)

It worked really well for everything I want it to do -- super simple 
and easy to build and add functions.

except - its a little messy
The idea I wanted to implement, is essentially this handler:
my  $DB = new Website::DB();
sub handler {
	DEBUG >0 && print STDERR " NEW 
REQUEST\n\n";
	my 	$r 		= shift;
	my 	$user 	= new Website::User( \$r, \$DB );
 	my 	$page 	= new Website::Page( \$user , \$DB );
	my 	$html 	= $page->processRequest();
	$r->content_type('text/html');
	$r->print( $html );
	return OK;
}

The idea, is that any page is just a view to a user (logged in or not), 
so is rendered to that person.

Now, this is my issue -- I'm creating a user AND a page with a ref to 
the DB handle - which is wasteful. And requires a lot of extra typing 
on my part.

Ideally, I would have the packages  in Website and WebAppFramework 
lookup the right DB for the Website

I can't figure out how to do this in a coherent way though.
Any  advice would be excellent.
--
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: Apache::Directive::conf tree error with mod_perl 1.99x and Apache 2

2004-11-17 Thread Beberle

--- Tom Schindl <[EMAIL PROTECTED]> wrote:

> Beberle wrote:
> 
> >Ok, I've read the documentation and searched the
> >archives for a similar problem but no luck.  If
> anyone
> >has any suggestions, I'd be most grateful.
> >
> >Here's my situation:
> >
> >I've got Apache 2.0.46 with mod_perl 1.99_09
> (called 
> >2.0-tobe in the documentation) both of which were
> >installed by the Red Hat Enterprise installation.
> >
> >I copied this startup file form the mod_perl docs:
> >
> >#!/usr/bin/perl
> ># File: startup.pl 
> >use Apache2 ();
> >use lib '/etc/httpd/lib/perl';
> >
> >use ModPerl::Util (); #for CORE::GLOBAL::exit
> >use Apache::compat ();
> >use Apache::RequestRec ();
> >use Apache::RequestIO ();
> >use Apache::RequestUtil ();
> >
> ># commented this out because Apache::ServerRec  
> ># doesn't exist on the server and throws errors
> >
> >#use Apache::ServerRec (); 
> >
> >use Apache::ServerUtil ();
> >use Apache::Connection ();
> >use Apache::Log ();
> >use APR::Table ();
> >use ModPerl::Registry ();
> >use Apache::Const -compile => ':common';
> >use APR::Const -compile => ':common';
> >use CGI qw(-compile :all);
> >
> >1;
> >---
> >
> >In my perl.conf file, I've added the following
> lines:
> >
> >LoadModule perl_module modules/mod_perl.so
> >PerlRequire conf/startup.pl
> >
> ># this is a test module
> >PerlTransHandler Apache::DefaultTrans 
> >--
> >
> >In my test module (modified from the O'Reilly
> "Writing
> >Apache Modules" book),  I have the following code:
> >
> >package Apache::DefaultTrans;
> ># File: Apache/DefaultTrans.pm
> >
> >use Apache::Const qw(:common);
> >use Apache::RequestIO ();
> >use Apache::RequestRec ();
> >use Apache::Log ();
> >use Apache::Directive ();
> >
> >sub handler {
> >my $r = shift;
> >my $uri = $r->uri;
> >
> >my $tree = Apache::Directive::conftree();
> >my $document_root =
> >$tree->lookup('DocumentRoot');
> >
> >$r->filename($document_root  . $r->uri);
> >}
> >-
> >
> >This throws the following error:
> >
> >[error] [client 10.1.0.28]  Usage:
> >Apache::Directive::conf tree(CLASS)  at
> >/etc/httpd/lib/perl/Apache/DefaultTrans.pm
> >
> >I've looked up this function in the documentation
> and
> >this seems to be the right way to use it.  Oddly,
> if I
> >try to stuff some random variable in, like:
> >
> >my $tree = Apache::Directive::conftree($tree);
> >
> >the error goes away, but $tree is empty.
> >
> >Any help is appreciated. Thanks.
> >
> >
> >
> > 
> >__ 
> >Do you Yahoo!? 
> >Meet the all-new My Yahoo! - Try it today! 
> >http://my.yahoo.com 
> > 
> >
> >
> >  
> >
> your version is out-dated you'll have to upgrade
> your mod_perl and apache
> nowadays we are at apache-2.52 and mp-1.99_17
>
http://perl.apache.org/docs/2.0/api/Apache/Directive.html#C_conftree_
> The method you try to use is part of mp-1.99_12 take
> a look at the since 
> information.
> 
> Tom

Ok, just installed Apache 2.0.52 and mod_perl 1.99_17
and everything seems to be working fine.  Thanks for
your help.




__ 
Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
http://my.yahoo.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: multiple instances of one web application

2004-11-17 Thread Harald Meier
Perrin wrote:
I would echo what Stas said about rethinking your need for this.  It's not
something that is easy to support in Perl.  However, if you really need to
do it without changing your application code or using virtualhosts, you
would probably have to do it by running multiple mod_perl backend servers
with a front-end apache reverse proxy server sending requests back to
them.  This kind of configuration is described in the mod_perl docs.
thanks for the info, might be a bit much afford.
do you know any way to put some placeholders inside the perl code that
will be replaced before compilation?
thanks!
harald. 

--
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: multiple instances of one web application

2004-11-17 Thread Harald Meier
Gernot Homma wrote:
i think you can use instances instead of classes, under mod_perl 1 i have 
the following setup (the code ist just to show how it should work ;.)
under mod_perl, i think you just have to change the name of the 
directives(PerlHandler => PerlResponseHandler), but i'm not shure, i 
haven't tried it out until now.
good idea!
but i cannot do it this way because the different instances might be of 
different versions of the application.

thanks!
harald.

--
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: Apache::Directive::conf tree error with mod_perl 1.99x and Apache 2

2004-11-17 Thread Tom Schindl
Beberle wrote:
Ok, I've read the documentation and searched the
archives for a similar problem but no luck.  If anyone
has any suggestions, I'd be most grateful.
Here's my situation:
I've got Apache 2.0.46 with mod_perl 1.99_09 (called 
2.0-tobe in the documentation) both of which were
installed by the Red Hat Enterprise installation.

I copied this startup file form the mod_perl docs:
#!/usr/bin/perl
# File: startup.pl 
use Apache2 ();
use lib '/etc/httpd/lib/perl';

use ModPerl::Util (); #for CORE::GLOBAL::exit
use Apache::compat ();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
# commented this out because Apache::ServerRec  
# doesn't exist on the server and throws errors

#use Apache::ServerRec (); 

use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use APR::Table ();
use ModPerl::Registry ();
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
use CGI qw(-compile :all);
1;
---
In my perl.conf file, I've added the following lines:
LoadModule perl_module modules/mod_perl.so
PerlRequire conf/startup.pl
# this is a test module
PerlTransHandler Apache::DefaultTrans 
--

In my test module (modified from the O'Reilly "Writing
Apache Modules" book),  I have the following code:
package Apache::DefaultTrans;
# File: Apache/DefaultTrans.pm
use Apache::Const qw(:common);
use Apache::RequestIO ();
use Apache::RequestRec ();
use Apache::Log ();
use Apache::Directive ();
sub handler {
   my $r = shift;
   my $uri = $r->uri;
   my $tree = Apache::Directive::conftree();
   my $document_root =
$tree->lookup('DocumentRoot');
   $r->filename($document_root  . $r->uri);
}
-
This throws the following error:
[error] [client 10.1.0.28]  Usage:
Apache::Directive::conf tree(CLASS)  at
/etc/httpd/lib/perl/Apache/DefaultTrans.pm
I've looked up this function in the documentation and
this seems to be the right way to use it.  Oddly, if I
try to stuff some random variable in, like:
my $tree = Apache::Directive::conftree($tree);
the error goes away, but $tree is empty.
Any help is appreciated. Thanks.

		
__ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 


 

your version is out-dated you'll have to upgrade your mod_perl and apache
nowadays we are at apache-2.52 and mp-1.99_17
http://perl.apache.org/docs/2.0/api/Apache/Directive.html#C_conftree_
The method you try to use is part of mp-1.99_12 take a look at the since 
information.

Tom
--
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: Segfaults with mod_php + mod_perl + mysql + mysqli

2004-11-17 Thread Tom Schindl
Sönke Ruempler wrote:
Stas Bekman wrote on Tuesday, November 16, 2004 10:03 PM:
 

Right. It's documented here:
http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_ex
it_signal_Segmentation_fault__11___with_mysql
   

I use PHP 5.0. There is no bundled mysql library with PHP anymore. I use
MySQL 4.1.7. But it seems mod_perl uses the old library (although
/usr/include and /usr/lib/mysql are clean from old versions). How can i
safely recompile the mysql module of Perl against the new mysql library (and
backupping the old if something goes wrong)?
 

mod_perl has no mysql support built in. You have to reinstall DBD::mysql 
from cpan.

Tom
--
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


Apache::Directive::conf tree error with mod_perl 1.99x and Apache 2

2004-11-17 Thread Beberle
Ok, I've read the documentation and searched the
archives for a similar problem but no luck.  If anyone
has any suggestions, I'd be most grateful.

Here's my situation:

I've got Apache 2.0.46 with mod_perl 1.99_09 (called 
2.0-tobe in the documentation) both of which were
installed by the Red Hat Enterprise installation.

I copied this startup file form the mod_perl docs:

#!/usr/bin/perl
# File: startup.pl 
use Apache2 ();
use lib '/etc/httpd/lib/perl';

use ModPerl::Util (); #for CORE::GLOBAL::exit
use Apache::compat ();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();

# commented this out because Apache::ServerRec  
# doesn't exist on the server and throws errors

#use Apache::ServerRec (); 

use Apache::ServerUtil ();
use Apache::Connection ();
use Apache::Log ();
use APR::Table ();
use ModPerl::Registry ();
use Apache::Const -compile => ':common';
use APR::Const -compile => ':common';
use CGI qw(-compile :all);

1;
---

In my perl.conf file, I've added the following lines:

LoadModule perl_module modules/mod_perl.so
PerlRequire conf/startup.pl

# this is a test module
PerlTransHandler Apache::DefaultTrans 
--

In my test module (modified from the O'Reilly "Writing
Apache Modules" book),  I have the following code:

package Apache::DefaultTrans;
# File: Apache/DefaultTrans.pm

use Apache::Const qw(:common);
use Apache::RequestIO ();
use Apache::RequestRec ();
use Apache::Log ();
use Apache::Directive ();

sub handler {
my $r = shift;
my $uri = $r->uri;

my $tree = Apache::Directive::conftree();
my $document_root =
$tree->lookup('DocumentRoot');

$r->filename($document_root  . $r->uri);
}
-

This throws the following error:

[error] [client 10.1.0.28]  Usage:
Apache::Directive::conf tree(CLASS)  at
/etc/httpd/lib/perl/Apache/DefaultTrans.pm

I've looked up this function in the documentation and
this seems to be the right way to use it.  Oddly, if I
try to stuff some random variable in, like:

my $tree = Apache::Directive::conftree($tree);

the error goes away, but $tree is empty.

Any help is appreciated. Thanks.




__ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.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: Segfaults with mod_php + mod_perl + mysql + mysqli

2004-11-17 Thread Sönke Ruempler
Stas Bekman wrote on Tuesday, November 16, 2004 10:03 PM:

> Right. It's documented here:
> http://perl.apache.org/docs/1.0/guide/troubleshooting.html#_ex
> it_signal_Segmentation_fault__11___with_mysql

I use PHP 5.0. There is no bundled mysql library with PHP anymore. I use
MySQL 4.1.7. But it seems mod_perl uses the old library (although
/usr/include and /usr/lib/mysql are clean from old versions). How can i
safely recompile the mysql module of Perl against the new mysql library (and
backupping the old if something goes wrong)?


--
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