Re: how to do this??

2000-11-03 Thread Perrin Harkins

On Thu, 2 Nov 2000, Michael wrote:
> #handler
> package MyHandler;
> 
> use Module qw(sub1 sub2);
> use Apache;
> use vars qw(@ISA)
> @ISA = qw (Module Apache);
> 
> calling sub1 from apache
> using THIS handler named "MyHandler" results in Module::sub1 
> identifing the "caller" as Apache.

Okay, I'll bite... Why do you want to change the caller?  I mean, Apache
really is the caller if this is being invoked directly in response to a
request.

Your AUTOLOAD trick will effectively change the caller, but it will also
slow things down.  Also, exporting subs chews up some memory and should be
avoided if possible.  Using fully-qualified names is the simplest way
around it.

- Perrin




Apache_1.3.14 mod_layout 1.24_01 core dump

2000-11-03 Thread George Sanderson

First, off, let me clairfy, I am a Newbie in almost every way. . .

I have the following configuration Apache 1.3.14, mod_perl-1.24_01
(static), Perl-5.6.0, Linux 2.2.14.
If I load load Apache::Icon, and mod_layout 2.8 (DSO), Apache will core
dump and the following gdb bt output is produced:

#0  0x8089c9d in ap_push_array (arr=0x) at alloc.c:1029
#1  0x2ac788f4 in push_item () from
/usr/local/lib/perl5/5.6.0/site_perl/i586-linux/auto/Apache/Icon/Icon.so
#2  0x2ac78a48 in add_alt () from
/usr/local/lib/perl5/5.6.0/site_perl/i586-linux/auto/Apache/Icon/Icon.so
#3  0x2ac78ad8 in add_icon () from
/usr/local/lib/perl5/5.6.0/site_perl/i586-linux/auto/Apache/Icon/Icon.so
#4  0x2ac78bdf in add_raw () from
/usr/local/lib/perl5/5.6.0/site_perl/i586-linux/auto/Apache/Icon/Icon.so
#5  0x2ac78c55 in add_icon_raw () from
/usr/local/lib/perl5/5.6.0/site_perl/i586-linux/auto/Apache/Icon/Icon.so
#6  0x808ec79 in invoke_cmd (cmd=0x2ac7a670, parms=0x7bd4,
mconfig=0x81c115c,args=0x7fffdb5e "(CMP,/icons/compressed.gif) x-compress
x-gzip") at http_config.c:808
#7  0x808f703 in ap_handle_command (parms=0x7bd4, config=0x81c0534,
l=0x7fffdb4c "AddIconByEncoding (CMP,/icons/compressed.gif) x-compress
x-gzip") at http_config.c:1028
#8  0x808f7a7 in ap_srm_command_loop (parms=0x7bd4, config=0x81c0534)
at http_config.c:1042
#9  0x808fe68 in ap_process_resource_config (s=0x81bf95c, fname=0x81c0f4c
"/usr/local/apache/conf/httpd.test", p=0x81bf934,ptemp=0x84121dc) at
http_config.c:1298
#10 0x8090762 in ap_read_config (p=0x81bf934, ptemp=0x84121dc,
confname=0x81af760 "conf/httpd.test") at http_config.c:1580
#11 0x809a6d1 in standalone_main (argc=4, argv=0x7ce4) at http_main.c:4640
#12 0x809af43 in main (argc=4, argv=0x7ce4) at http_main.c:5004

The tail of the strace was:
stat("/usr/local/apache/lib/perl/Apache/Icon.pmc", 0x7fffd7ac) = -1 ENOENT
(No such file or directory)
open("/usr/local/apache/lib/perl/Apache/Icon.pm", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat("/usr/local/lib/perl5/5.6.0/i586-linux/Apache/Icon.pmc", 0x7fffd7ac) =
-1 ENOENT (No such file or directory)
open("/usr/local/lib/perl5/5.6.0/i586-linux/Apache/Icon.pm", O_RDONLY) = -1
ENOENT (No such file or directory)
stat("/usr/local/lib/perl5/5.6.0/Apache/Icon.pmc", 0x7fffd7ac) = -1 ENOENT
(No such file or directory)
open("/usr/local/lib/perl5/5.6.0/Apache/Icon.pm", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat("/usr/local/lib/perl5/5.6.0/site_perl/i586-linux/Apache/Icon.pmc",
0x7fffd7ac) = -1 ENOENT (No such file or directory)
open("/usr/local/lib/perl5/5.6.0/site_perl/i586-linux/Apache/Icon.pm",
O_RDONLY) = 5
fstat(5, {st_mode=S_IFREG|0444, st_size=2333, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
0x2aac6000
read(5, "package Apache::Icon;\n\nuse stric"..., 4096) = 2333
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
close(5)= 0

munmap(0x2aac6000, 4096)= 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
rt_sigprocmask(SIG_BLOCK, NULL, [], 8)  = 0
--- SIGSEGV (Segmentation fault) ---
+++ killed by SIGSEGV +++

I have a similar problem when I replace mod_layout with mod_auth_mda (DSO),
however I do not have a problem if i do not load mod_perl with the other
modules or if I do not load the other DSO modules (mod_layout or
mod_auth_mda).

No error_log output is generated.

Looks like some kind of  munmap() problem to me.

If will appreciate any help I can get.  Thanks in advance.






POST results in "HTTP/1.0 (null)" ??

2000-11-03 Thread Paul J. Lucas

So from within a function, I'm doing

my $r = Apache::Request->new( Apache->request() );
warn "request=", $r->as_string(), "\n";

and, when I to a POST request, I get:

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*
Content-Length: 6978
Content-Type: multipart/form-data; boundary=curl3cwvW7Ge8lVBtEGuDRCENOMeIVO
Host: www.abacus-new.com:80
Pragma: no-cache
User-Agent: Mozilla/4.0

HTTP/1.0 (null)

Why is the content merely "HTTP/1.0 (null)"?  What happened to
the other 6900 bytes or so?

If I write a mimi server in Perl that jsut dumps the contents
of the HTTP post, the posted data is correct.

- Paul




Re: [warn] [notice] child_init for process 3394, report any problems to [no address given]

2000-11-03 Thread G.W. Haywood

Hi there,

On Fri, 3 Nov 2000, Jose Albert wrote:

> how to solve this problem ...?
> 
> still waiting for server to warm up...not ok
> 
> t/logs/error_log :
> [warn] [notice] child_init for process 3394

What happens if you run 'apachectl configtest'?

73,
Ged.




Re: AuthCookie

2000-11-03 Thread Bill Moseley

At 03:30 PM 11/03/00 -0500, Charles Day wrote:
>The follow also holds true:
>
>http://www.mydomain.com/index.cgi?a=blablabla&b=blablabla
>
>gets redirected to:
>
>http://www.mydomain.com/index.cgi 

If I remember, that's just due to the example in the AuthCookie POD that uses 
$r->prev->uri to set the destination parameter in the Login script.  uri()
doesn't include the query string, IIRC.

>I've replaced the following line in AuthCookie.pm 
>
>$r->header_out("Location" => "$args{'destination'}");
>
>with:
>
>$r->header_out("Location" => "$ENV{HTTP_REFERER}");

I wouldn't do that as it's client dependent (and in quotes ;).

>And we don't loose the data.  Is there a better mod_perlish way to do this
>and are there buffer overflow risks involved?  

Use a mod_perl handler or Apache::Registry script for the login script, and
include $r->prev->args.  There's probably better ways to get the full URL,
but I just put uri() and args() together.

I suppose if your login.pl script could just place the current fields
passed in on the POST to the destination parameter passed to AuthCookie.
Then your script would get the parameters, they would just be a GET instead
of a POST.  Can be kind of ugly.



Bill Moseley
mailto:[EMAIL PROTECTED]



mod_perl vs. perl-5.6.0 ? (fwd)

2000-11-03 Thread Ciaran . Deignan



Hi,

I'm not subscribed to this list, so please copy me in any replies...


I'm trying to build a binary distribution of mod_perl-1.24 for AIX-4.3.2.
I have Apache-1.3.14 up and running (compiled with EAPI), and I have a
choice of using either perl-5.5.3 or perl-5.6.

With perl-5.5.3, your configure script reccomends applying a patch.
However this perl comes from IBM, so I don't know if the patch is applied.

I also distribute my own binary for perl, currently in version
5.6. Your configure script tells me to rebuild apache with
"-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64", however I can't find either
of these symbols in the Apache source tree.

When I test with perl-5.5.3, everything appears to work. However when I
build with perl-5.6.0, my browser (netscape navigatior on a PC) tells me
that "the document contains no data", and there's a trace of a core-dump
in the apache errlog.

I've noticed a version mod_perl-1.24.1 on the download site, dated the
13th of October (the day the new apache came out) but its inaccessible.
I'm suspicious, is this a known problem?

thanks for any pointers,
Ciaran

+-+
Ciaran DeignanTel: (France) 04 76 29 79 92
BULL XS-BU (http://www-frec.bull.com) HA and Consolidation

Mail to: [EMAIL PROTECTED]Bullcom: 229 79 92
PGP: B1 78 FB 88 FD 86 58 A8  89 7B 22 8C D0 E8 71 FC   Fax: 229 75 18
+-+




Re: HTTP Mod_Perl mini-server

2000-11-03 Thread Perrin Harkins

On 3 Nov 2000, David Hodgkinson wrote:

> > In my tests, a modern version of mod_proxy (serving from cache) was faster
> > than Squid on Linux.
> 
> Really? Cool. What about taking memory usage into account?

Well, Squid is kind of a memory hog and mod_proxy has been extremely light
and well-behaved, even under heavy load.  I would encourage others to try
benchmarking it for themselves, but I currently see no reason to use Squid
over mod_proxy.
- Perrin




Re: HTTP Mod_Perl mini-server

2000-11-03 Thread David Hodgkinson

Perrin Harkins <[EMAIL PROTECTED]> writes:

> On 3 Nov 2000, David Hodgkinson wrote:
> > Dare I add that Squid has plenty of low-latency cacheing features you
> > could use? 
> 
> In my tests, a modern version of mod_proxy (serving from cache) was faster
> than Squid on Linux.

Really? Cool. What about taking memory usage into account?

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



AuthCookie

2000-11-03 Thread Charles Day

It's been addressed under LIMITATIONS that if the first unauthenticated
request is a POST, that POSTed data will be lost.

The follow also holds true:

http://www.mydomain.com/index.cgi?a=blablabla&b=blablabla

gets redirected to:

http://www.mydomain.com/index.cgi 

if it's the first unauthenticated request, the POSTed data is indeed lost.

I've replaced the following line in AuthCookie.pm 

$r->header_out("Location" => "$args{'destination'}");

with:

$r->header_out("Location" => "$ENV{HTTP_REFERER}");

And we don't loose the data.  Is there a better mod_perlish way to do this
and are there buffer overflow risks involved?  

Hidden POST data still gets lost, but this will fix my current problem of my
Marketing people sending these broken links around town.  

Thanks,

Charles




Re: HTTP Mod_Perl mini-server

2000-11-03 Thread Perrin Harkins

On Fri, 3 Nov 2000, Vivek Khera wrote:
> Lately I've been getting very interested in using solid-state disks
> for high-performance issues.  They're expensive, but if you need that
> much speed, they're worth it.

Are they?  I tried one once, and it wasn't any faster than my normal disk
because I had so much RAM it was all getting buffered already.  If you
don't have enough RAM, it might help, but I suspect these are more
expensive than equivalent amounts of RAM.

- Perrin




Re: HTTP Mod_Perl mini-server

2000-11-03 Thread Perrin Harkins

On 3 Nov 2000, David Hodgkinson wrote:
> Dare I add that Squid has plenty of low-latency cacheing features you
> could use? 

In my tests, a modern version of mod_proxy (serving from cache) was faster
than Squid on Linux.

- Perrin




Re: how do I store/retrieve a hash through Apache::Session?

2000-11-03 Thread Randy Harmon


Once you realize that %session entries have to be scalars (references) as
described by other responses, be sure when you change entries in the
sub-hash that you tell the top-level session that the data's been changed
(it won't realize it unless you change one of its scalars).

Check the docs or the archives for the "official way" to do this (a message
from Jeffrey Baker uses such a phrase), but any modification of a %session
scalar will do - $session{_changed}++; , f'rinstance.

Best,

Randy

On Fri, Nov 03, 2000 at 04:36:15PM +, Enrique I . Rodriguez wrote:
> Maybe a silly question... 
> 
> how do I store/retrieve a hash through Apache::Session?
> 
> This doesn't work...
> # retrieve
> %table=$session{table};
> ...
> # store
> $session{table}=%table;
> 
> What's my fault?



[warn] [notice] child_init for process 3394, report any problems to [no address given]

2000-11-03 Thread Jose Albert

Thanks to G.W. Haywood <[EMAIL PROTECTED]>
for his answer about the
[crit] (98)Address already in use: make_sock: could not bind to port 8529
error

>How many copies of httpd are there running on your machine?

>73,
>Ged.

He's right there was another httpd process running and it happend after fail
the following test.

But how to solve this problem ...?

httpd listening on port 8529
will write error_log to: t/logs/error_log
letting apache warm up...\c
done
/usr/bin/perl t/TEST 0
still waiting for server to warm up...not ok
server failed to start! (please examine t/logs/error_log) at t/TEST line 95.
make: *** [run_tests] Error 9

t/logs/error_log :
[warn] [notice] child_init for process 3394, report any problems to [no
address given]


Thanks in advance

Regards

Jose Albert




Re: how do I store/retrieve a hash through Apache::Session?

2000-11-03 Thread Tom Harper

Enrique--

You need to store/retrieve it as a ref-

\%my_hash

Tom

At 04:36 PM 11/3/00 +, Enrique I.Rodriguez wrote:
>Maybe a silly question... 
>
>how do I store/retrieve a hash through Apache::Session?
>
>This doesn't work...
># retrieve
>%table=$session{table};
>...
># store
>$session{table}=%table;
>
>What's my fault?
>



[warn] [notice] child_init for process 3394, report any problems to [no address given]

2000-11-03 Thread Jose Albert

Thanks to G.W. Haywood <[EMAIL PROTECTED]>
for his answer about the
[crit] (98)Address already in use: make_sock: could not bind to port 8529
error

>How many copies of httpd are there running on your machine?

>73,
>Ged.

He's right there was another httpd process running and it happend after fail
the following test.

But how to solve this problem ...?

httpd listening on port 8529
will write error_log to: t/logs/error_log
letting apache warm up...\c
done
/usr/bin/perl t/TEST 0
still waiting for server to warm up...not ok
server failed to start! (please examine t/logs/error_log) at t/TEST line 95.
make: *** [run_tests] Error 9

t/logs/error_log :
[warn] [notice] child_init for process 3394, report any problems to [no
address given]


Thanks in advance

Regards

JOse Albert




Re: how do I store/retrieve a hash through Apache::Session?

2000-11-03 Thread Tim Bishop



On Fri, 3 Nov 2000, Enrique I.Rodriguez wrote:

> Maybe a silly question... 
> 
> how do I store/retrieve a hash through Apache::Session?

store hash references, not hashes.

> 
> This doesn't work...
> # retrieve
> %table=$session{table};

$tableref = $session{table};


> ...
> # store
> $session{table}=%table;

$session{table}= \%table;

or, preferably:


my $tableref = {};

# add stuff to table
# ...

$session{table}= $tableref;

> 
> What's my fault?
> 




RE: dynamic vs. mostly static data

2000-11-03 Thread Jerrad Pierce

Yeah that was it

But you could probably even use Memoize for somehting like this?

>-Original Message-
>From: Peter Haworth [mailto:[EMAIL PROTECTED]]
>Sent: Friday, November 03, 2000 12:43 PM
>To: Jerrad Pierce; 'Neil Conway'; ModPerl List
>Subject: RE: dynamic vs. mostly static data
>
>
>It might have been my Cache::Mmap module, which is ideal for 
>this kind of
>thing. It depends on what your data looks like though, of course.
>
>On Thu, 2 Nov 2000 16:48:24 -0500 , Jerrad Pierce said:
>
>> There is a query caching module someone posted here redently...
>>  Or was it proposed and beta-ish?
>>  
>>  Another thing you might consider doing is having a cron job 
>do your periodic
>>  (10 min.)
>>  fetch and store it as a file somewhere... Then use SSI or some more
>>  mod_perl-ish means of including this static content...
>>  
>>  >-Original Message-
>>  >From: Neil Conway [mailto:[EMAIL PROTECTED]]
>>  >Sent: Thursday, November 02, 2000 4:45 PM
>>  >To: ModPerl List
>>  >Subject: dynamic vs. mostly static data
>>  >
>>  >
>>  >I'm writing a web app in mod_perl, using a PostgreSQL database
>>  >backend and HTML::Template. In looking for ways to optimize
>>  >performance, I noticed that although my code is doing several
>>  >(say, 4-5) database queries per handler/webpage, a large part
>>  >of the data (~2 queries) is mostly static (it will change
>>  >perhaps once per week, or once per month). It's obviously
>>  >inefficient to run these queries on the database for every
>>  >single request.
>>  >
>>  >How can I 'cache' this data so that all Apache children can
>>  >access it quickly? Is there a way to automatically update
>>  >this cache periodically (say every 10 minutes)? Also, this
>>  >solution should work on any reasonably modern UNIX system
>>  >(Win32 is not important for now).
>>  >
>>  >I couldn't find this anywhere, but if someone tells me where,
>>  >I'd be happy to RTFM. Ask me if you need more info.
>
>-- 
>   Peter Haworth   [EMAIL PROTECTED]
>"Writing for a penny a word is ridiculous.  If a man really 
>wants to make
> a million dollars, the best way would be to start his own religion."
>   -- L. Ron Hubbard
>
>



RE: dynamic vs. mostly static data

2000-11-03 Thread Peter Haworth

It might have been my Cache::Mmap module, which is ideal for this kind of
thing. It depends on what your data looks like though, of course.

On Thu, 2 Nov 2000 16:48:24 -0500 , Jerrad Pierce said:

> There is a query caching module someone posted here redently...
>  Or was it proposed and beta-ish?
>  
>  Another thing you might consider doing is having a cron job do your periodic
>  (10 min.)
>  fetch and store it as a file somewhere... Then use SSI or some more
>  mod_perl-ish means of including this static content...
>  
>  >-Original Message-
>  >From: Neil Conway [mailto:[EMAIL PROTECTED]]
>  >Sent: Thursday, November 02, 2000 4:45 PM
>  >To: ModPerl List
>  >Subject: dynamic vs. mostly static data
>  >
>  >
>  >I'm writing a web app in mod_perl, using a PostgreSQL database
>  >backend and HTML::Template. In looking for ways to optimize
>  >performance, I noticed that although my code is doing several
>  >(say, 4-5) database queries per handler/webpage, a large part
>  >of the data (~2 queries) is mostly static (it will change
>  >perhaps once per week, or once per month). It's obviously
>  >inefficient to run these queries on the database for every
>  >single request.
>  >
>  >How can I 'cache' this data so that all Apache children can
>  >access it quickly? Is there a way to automatically update
>  >this cache periodically (say every 10 minutes)? Also, this
>  >solution should work on any reasonably modern UNIX system
>  >(Win32 is not important for now).
>  >
>  >I couldn't find this anywhere, but if someone tells me where,
>  >I'd be happy to RTFM. Ask me if you need more info.

-- 
Peter Haworth   [EMAIL PROTECTED]
"Writing for a penny a word is ridiculous.  If a man really wants to make
 a million dollars, the best way would be to start his own religion."
-- L. Ron Hubbard





Re: how do I store/retrieve a hash through Apache::Session?

2000-11-03 Thread Chris Winters

* Enrique I.Rodriguez ([EMAIL PROTECTED]) [001103 12:41]:
> Maybe a silly question... 
> 
> how do I store/retrieve a hash through Apache::Session?
> 
> This doesn't work...
> # retrieve
> %table=$session{table};
> ...
> # store
> $session{table}=%table;
> 
> What's my fault?

You can only store/read references:

 my %table = (this => 'that' );
 $session{table} = \%table;

 ...

 my $table = $session{table};
 foreach my $key ( keys %{ $table } ) {
   print "$key = $table->{ $key }\n";
 }

see 'perldoc perlref' for much more on references.

HTH

Chris

-- 
Chris Winters
Senior Internet Developerintes.net
[EMAIL PROTECTED]   http://www.intes.net/
Integrated hardware/software solutions to make the Internet work for you.



how do I store/retrieve a hash through Apache::Session?

2000-11-03 Thread Enrique I . Rodriguez

Maybe a silly question... 

how do I store/retrieve a hash through Apache::Session?

This doesn't work...
# retrieve
%table=$session{table};
...
# store
$session{table}=%table;

What's my fault?



Re: HTTP Mod_Perl mini-server

2000-11-03 Thread Vivek Khera

> "MS" == Matt Sergeant <[EMAIL PROTECTED]> writes:

MS> doing it this way. If you're that concerned about perhaps the weight of
MS> Apache + mod_perl, consider trying TUX or thttpd, or something else
MS> lightweight written in C.

Lately I've been getting very interested in using solid-state disks
for high-performance issues.  They're expensive, but if you need that
much speed, they're worth it.  I'm looking more for mail spool issues,
but I guess for serving up static content, it might make sense...

Personally for this type of thing I'd start with one of the mini web
servers and tweak it by hand to meet my needs (logging to a database
as you indicated).

But then it isn't mod perl and you can't discuss it here ;-)

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D.Khera Communications, Inc.
Internet: [EMAIL PROTECTED]   Rockville, MD   +1-240-453-8497
GPG & MIME spoken herehttp://www.khera.org/~vivek/



Re: HTTP Mod_Perl mini-server

2000-11-03 Thread G.W. Haywood

Hi all,

> At 09:46 AM 11/3/00 +, Nigel Hamilton wrote:
> >I would like to write this mini-server in perl ... but maybe a threaded
> >programming language is better?
> >I'm contracting for an Ad Serving company and we were mooting the idea of
> >writing our own lean and mean web server for serving the Ads.

Matt's right, don't do it.  And Gunther, what on earth is the date on
your machine doing?

73,
Ged.




Re: Apache::Filter Install Problem

2000-11-03 Thread G.W. Haywood

Hi there,

On Thu, 2 Nov 2000, Adam Prime wrote:

> i built mod_perl with this:
> perl Makefile.PL DO_HTTPD=1 USE_APACI=1 APACHE_PREFIX=/usr/local/apache
> PERL_STACKED_HANDLERS=1
> Any insight would be appreciated.  I'm installing it on a redhat 6.2 box
> with apache 1.3.14 and mod_perl 1.24_01 installed from source, and the perl
> 5.005 updated rpm from redhat.

Pretty good description.  I'd try rebuilding Perl 5.005_03 from source.
Use the same compiler you used to build mod_perl.  Don't use RPMs.

I'm not promising anything mind...

73,
Ged.
 




Re: [crit] (98)Address already in use: make_sock: could not bind to port 8529

2000-11-03 Thread G.W. Haywood

Hi there,

On Thu, 2 Nov 2000, Jose Albert wrote:

> I'm trying to set mod_perl with apache, all the compilation process look
> fine but the test  ends with this error in the
> 
> t/logs/error_log :
> [Thu Nov  2 19:36:30 2000] [crit] (98)Address already in use: make_sock:
> could not bind to port 8529

How many copies of httpd are there running on your machine?

73,
Ged.




Re: proxy front-ends (was: Re: ApacheCon report)

2000-11-03 Thread Joe Schaefer

Gunther Birznieks <[EMAIL PROTECTED]> writes:

> Although I don't have much to add to the conversation, I just wanted to say 
> that this is one of the most absolutely technically enlightening posts I've 
> read on the mod_perl list in a while. It's really interesting to finally 
> clarify this once and for all.

You bet - brilliant detective/expository work going on here!  
On a side note, a while back I was trying to coerce the TUX developers 
to rework their server a little.  I've included snippets of the 
email correspondence below:



From: Joe Schaefer <[EMAIL PROTECTED]>
Subject: Can tux 'proxy' for the user space daemon?
Date: 06 Oct 2000 13:32:10 -0400

It would be great if TUX is someday capable of 
replacing the "reverse proxy" kludge for mod_perl.
>From skimming the docs, it seems that 

TUX on port 80 +
apache on 8080

seems to fit this bill.

Question: In this setup, how does TUX behave wrt 
HTTP/1.1 keepalives to/from apache? 

Say apache is configured with mod_perl, and 
keepalives are disabled on apache.
Is TUX capable of maintaining keepalives on the 
browser <-> TUX connection, while maintaining a 
separate "pool" of (closed) TUX <-> apache connections?

If I'm way off here on how TUX works  (or will work),
please correct me!

Thanks.

==

From: Ingo Molnar <[EMAIL PROTECTED]>
Subject: Re: Can tux 'proxy' for the user space daemon?
Date: Sat, 7 Oct 2000 13:42:49 +0200 (CEST)

if TUX sees a request that is redirected to Apache, then all remaining
requests on the connection are redirected to Apache as well. TUX wont ever
see that connection again, the redirection works by 'trimming' all
previous input up to the request which goes to Apache, then the socket
itself is hung into Apache's listen socket, as if it came as a unique
request from the browser. This technique is completely transparent both to
Apache and to the browser. There is no mechanizm to 'bounce back' a
connection from Apache to TUX. (while connections do get bounced back and
forth between the kernel and user-space TUX modules.)

so eg. if the first 2 request within a single persistent HTTP/1.1
connection can be handled by TUX then it will be handled by TUX, and the
third (and all succeeding) requests will be redirected to Apache. Logging
will happen by TUX for the first 2 requests, and the remaining requests
will be logged by Apache.

==

From: Joe Schaefer <[EMAIL PROTECTED]>
Subject: Re: Can tux 'proxy' for the user space daemon?
Date: 07 Oct 2000 19:52:31 -0400

Too bad- this means that HTTP/1.1 pages generated by an apache module won't 
benefit from TUX serving the images and stylesheet links contained therein. I 
guess disabling keepalives on the apache connection is (still) the only way 
to go.

I still think it would be cool if there was some hack to make this work- 
perhaps a TUX "gateway" module could do it?  Instead of handing off a 
request directly to apache, maybe a (user-space) TUX module could hand it 
off and then return control back to TUX when the page has been delivered.
Is such a "gateway" TUX module viable?

=

From: Ingo Molnar <[EMAIL PROTECTED]>
Subject: Re: Can tux 'proxy' for the user space daemon?
Date: Mon, 9 Oct 2000 11:42:57 +0200 (CEST)

depends on the complexity of the module. If it's simple functionality then
it might be best to write a dedicated TUX module for it, without Apache.

but if it's too complex then the same code that is used to hand a TCP
connection over to Apache can be used by Apache to send a connection back
to TUX as well. A new branch of the TUX system-call could handle this.

Ingo




This might be worth looking in to (for linux anyway :).
-- 
Joe Schaefer



Re: dynamic vs. mostly static data

2000-11-03 Thread Ken Y. Clark

On Thu, 2 Nov 2000, Neil Conway wrote:

> Date: Thu, 2 Nov 2000 16:45:28 -0500
> From: Neil Conway <[EMAIL PROTECTED]>
> To: ModPerl List <[EMAIL PROTECTED]>
> Subject: dynamic vs. mostly static data
> 
> I'm writing a web app in mod_perl, using a PostgreSQL database
> backend and HTML::Template. In looking for ways to optimize
> performance, I noticed that although my code is doing several
> (say, 4-5) database queries per handler/webpage, a large part
> of the data (~2 queries) is mostly static (it will change
> perhaps once per week, or once per month). It's obviously
> inefficient to run these queries on the database for every
> single request.
> 
> How can I 'cache' this data so that all Apache children can
> access it quickly? Is there a way to automatically update
> this cache periodically (say every 10 minutes)? Also, this
> solution should work on any reasonably modern UNIX system
> (Win32 is not important for now).
> 
> I couldn't find this anywhere, but if someone tells me where,
> I'd be happy to RTFM. Ask me if you need more info.
> 
> TIA,
> 
> Neil

neil,

i often do something like this where i allow each individual child
process to cache it's data.  i do something like this:

package Apache::Foo;

use strict;
use Apache::Constants;
use POSIX 'strftime';

use constant CACHE_EXPIRES => 3600; # one hour
use vars qw[ %CACHE ];
%CACHE = ();

sub handler {
my $r = shift;

eval {
my $expires = $CACHE{'expires'} || 0; 
if ($expires < time) {
my @data = < some routine >;
my $t = HTML::Template->new(filename  => 'foo.tmpl',
die_on_bad_params => 0,
cache => 1);  
$t->param('data', \@data);

$CACHE{'data'}= $t->output;
$CACHE{'expires'} = time + CACHE_EXPIRES;
}
$r->print($CACHE{'data'});
};

return print_err($r, $@) if $@;
return OK;
}

1;

btw, i'd really recommend you look into using Template Toolkit.  it's a
much more powerful and flexible templating system than HTML::Template,
but i digress (and might start a flame war against myself by saying this).

hth,

ky




Re: a web interface to visualize tables

2000-11-03 Thread Benoit Caron



Thomas von Elling Skifter Eibner wrote:
> 
> On Wed, Nov 01, 2000 at 04:57:59PM +0100, Louis-David Mitterrand wrote:
> > Hello,
> >
> > I need a tool to interactively visualize DB tables from a web interface.
> > Ideally this tool would let me:
> >
> > - rename column headers,
> > - set cell alignments, widths, background colors,
> > - reorder columns,
> > - save all these visualisation settings in a DB,
> > - it would be written in perl (even better: mod_perl),
> >
> > Does such a beast exist? I am in the process of writing one, so I
> > thought I'd check first...
> 
> Which Database are you thinking of? DBM files? SQL database? For SQL databases there 
>is phpMyAdmin (for MySQL) and phpPgAdmin (Postgresql), but those are written in PHP. 
>The functionality should be pretty easy to transfer if you look at php**Admin as an 
>example. Maybe it could even be a whole lot better by allowing 'plugins' like the way 
>DBI has database drivers..
> 
> I would be able to spend some time help testing/developing on a project like this, 
>so if you want help just email me.
> 


This is something, a long time ago, that I tried to find time to begin
work on (with no real succes, alas.). I'm willing to spend some time
testing and developping on a project like this... The idea of having it
be "database-portable" could be really cool to do!



-- 
Benoit Caron
Analyste-Programmeur
Netgraphe - Webfin.com - Le Web Financier
[EMAIL PROTECTED]
(514)847-9155 poste 3151
- - - - - - - - - - - - - - - - - - - - - - - -
"The number of Unix installations has grown to 10, 
 with more expected." 
-- The Unix Programmer's Manual, 2nd edition, June '72



Re: HTTP Mod_Perl mini-server

2000-11-03 Thread Gunther Birznieks

Other than some of the caching other people talked about (eg squid)...You 
might also take a look at mod_mmap to hold the ads in shared memory among 
the Apache processes and still use mod_perl for the logic of which ad to serve.

Later,
Gunther

At 09:46 AM 11/3/00 +, Nigel Hamilton wrote:
>Hi,
>
>I'm contracting for an Ad Serving company and we were mooting the idea of
>writing our own lean and mean web server for serving the Ads.
>
>We would like to hold all the Ads in memory (each Ad is less than 20K).
>
>The next thing is to create a pool of mod_perl-esque processes that will
>handle the AD requests and also hold persistent connections to the
>database.
>
>I would like to write this mini-server in perl ... but maybe a threaded
>programming language is better?
>
>Does anyone know a good process/threading model for handling the requests
>and passing them around? Will we see a significant performance improvement
>in any event?
>
>NIge

__
Gunther Birznieks ([EMAIL PROTECTED])
eXtropia - The Web Technology Company
http://www.extropia.com/




(fwd) RE: [dcpm] Zombies under mod_perl?

2000-11-03 Thread Chris Winters

I think the mod_perl analogy Mark mentions here is hilarious!

- Forwarded message from Mark D Wolinski <[EMAIL PROTECTED]> -

From: "Mark D Wolinski" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
Subject: RE: [dcpm] Zombies under mod_perl?
Date: Thu, 2 Nov 2000 14:10:52 -0700
Message-ID: <[EMAIL PROTECTED]>
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0)

Why, that makes so much sense, it could possibly work. :-)

I love mod_perl.  Much like my ex-girlfriend, it seems ready, willing and
able to point out my inadequacies.

Thanks
Mark W

...

- End forwarded message -

-- 
Chris Winters
Senior Internet Developerintes.net
[EMAIL PROTECTED]   http://www.intes.net/
Integrated hardware/software solutions to make the Internet work for you.



Re: DBI

2000-11-03 Thread David Hodgkinson

"Tamas" <[EMAIL PROTECTED]> writes:

> Am I looking in the right place? I just don't seem to be able to find
> the right docs in Perldoc or Apache or perl.apache.org.

Only if your issue is mod_perl related... ;-)


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

2000-11-03 Thread remco

On Fri, 3 Nov 2000, Tamas wrote:

> Hi,

Hello,

> I am hoping that I have joined the right group for these questions,
> so before I go straight into my question, I'll outline the problem
> that I am working on at the moment. Then I can get shot down if I'm
> in the wrong place ;0
> 
> I am currently working on some DBI, in particular Auth, Authen, Authz
> for Authorisation of users on an Apache web server with mySQL database.

Try CPAN:
Apache::AuthDBI

Is pretty configurable, works with mySQL. There are some others as well...

> Am I looking in the right place? I just don't seem to be able to find
> the right docs in Perldoc or Apache or perl.apache.org.
> 
> Cheers,
> Tom

Bye
remco

/--\
| Remco Schaar |
| e-mail: [EMAIL PROTECTED]  |
\--/

South Park meets Linux:
- "Oh my God, they killed init!"
- "You bastards!"




DBI

2000-11-03 Thread Tamas

Hi,

I am hoping that I have joined the right group for these questions,
so before I go straight into my question, I'll outline the problem
that I am working on at the moment. Then I can get shot down if I'm
in the wrong place ;0

I am currently working on some DBI, in particular Auth, Authen, Authz
for Authorisation of users on an Apache web server with mySQL database.

Am I looking in the right place? I just don't seem to be able to find
the right docs in Perldoc or Apache or perl.apache.org.

Cheers,
Tom



Re: HTTP Mod_Perl mini-server

2000-11-03 Thread David Hodgkinson

Matt Sergeant <[EMAIL PROTECTED]> writes:

> egads, don't do it... Web servers are well developed for this kind of
> thing, and modern filesystems (e.g. ext2fs) will buffer the ads in RAM
> anyway if you have enough. You're not likely to get any speed increase
> doing it this way. If you're that concerned about perhaps the weight of
> Apache + mod_perl, consider trying TUX or thttpd, or something else
> lightweight written in C.

Dare I add that Squid has plenty of low-latency cacheing features you
could use? 

-- 
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: HTTP Mod_Perl mini-server

2000-11-03 Thread Matt Sergeant

On Fri, 3 Nov 2000, Nigel Hamilton wrote:

> Hi,
> 
> I'm contracting for an Ad Serving company and we were mooting the idea of
> writing our own lean and mean web server for serving the Ads.
> 
> We would like to hold all the Ads in memory (each Ad is less than 20K).
> 
> The next thing is to create a pool of mod_perl-esque processes that will
> handle the AD requests and also hold persistent connections to the
> database.
> 
> I would like to write this mini-server in perl ... but maybe a threaded
> programming language is better?
> 
> Does anyone know a good process/threading model for handling the requests
> and passing them around? Will we see a significant performance improvement
> in any event?

egads, don't do it... Web servers are well developed for this kind of
thing, and modern filesystems (e.g. ext2fs) will buffer the ads in RAM
anyway if you have enough. You're not likely to get any speed increase
doing it this way. If you're that concerned about perhaps the weight of
Apache + mod_perl, consider trying TUX or thttpd, or something else
lightweight written in C.

-- 


/||** Director and CTO **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** Personal Web Site: http://sergeant.org/ **
 \\//
 //\\
//  \\




HTTP Mod_Perl mini-server

2000-11-03 Thread Nigel Hamilton

Hi,

I'm contracting for an Ad Serving company and we were mooting the idea of
writing our own lean and mean web server for serving the Ads.

We would like to hold all the Ads in memory (each Ad is less than 20K).

The next thing is to create a pool of mod_perl-esque processes that will
handle the AD requests and also hold persistent connections to the
database.

I would like to write this mini-server in perl ... but maybe a threaded
programming language is better?

Does anyone know a good process/threading model for handling the requests
and passing them around? Will we see a significant performance improvement
in any event?

NIge






Re: dynamic vs. mostly static data

2000-11-03 Thread Matt Sergeant

On Thu, 2 Nov 2000, Neil Conway wrote:

> I'm writing a web app in mod_perl, using a PostgreSQL database
> backend and HTML::Template. In looking for ways to optimize
> performance, I noticed that although my code is doing several
> (say, 4-5) database queries per handler/webpage, a large part
> of the data (~2 queries) is mostly static (it will change
> perhaps once per week, or once per month). It's obviously
> inefficient to run these queries on the database for every
> single request.
> 
> How can I 'cache' this data so that all Apache children can
> access it quickly? Is there a way to automatically update
> this cache periodically (say every 10 minutes)? Also, this
> solution should work on any reasonably modern UNIX system
> (Win32 is not important for now).

Along with all the other fine suggestions here, you might like to check
out the Memoize module on CPAN. I don't think it yet offers a way to
invalidate the cache, but I know that is planned.

-- 


/||** Director and CTO **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** Personal Web Site: http://sergeant.org/ **
 \\//
 //\\
//  \\




Re: Seg Fault Issues- mod_perl and XML::Parser

2000-11-03 Thread Matt Sergeant

On Thu, 2 Nov 2000, Tom Harper wrote:

> Hi--
> 
> In case anyone encounters the same segv issues,
> recompiled apache with mod_perl 1.24--
> 
> explicitly set Rule EXPAT=no rather than 
> Rule EXPAT=default in the apache_base/src/Configure.  
> 
> No more segv.
> 
> Then i recompiled again with mod_perl 1.23.  
> 
> Again, no more segv.
> 
> Go figure.

I'm sure that's almost exactly what the axkit faq tells you to do :-)

The problem is that the expat isn't in mod_dav, its in Apache, so even if
you don't have mod_dav installed, Apache compiles in expat. If at a later
date you feel you need mod_dav you can use the patches in the axkit
download directory.

> Anyhow, based on this experience we are very enthusiastic
> about XML::Parser package.  We are mis-using XML::Parser 
> as part of a X(HT)ML based templating engine, and since the
> fix it has handled significant load without complaint
> (>50 concurrent connections).

Just a word of warning: XML::Parser is slower than you think. All the
method calls, back and forth from C to Perl, and having one of those for
every node in the XML document, is all very slow. Cache what you can,
whenever you can, or your platform won't scale very well. (speaking from
direct personal experience).

-- 


/||** Director and CTO **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** Personal Web Site: http://sergeant.org/ **
 \\//
 //\\
//  \\