binary cgi mess
I have a mod_perl server and I need to add a cgi application outside mod_perl, nagios. I followed the guide and when I try to use the cgis, the binary files are downloaded instead of executed. I tried the same in another apache server without Mason and it worked well. So I think something of my config must be messing it. I made sure the mason handler wasn't in the middle. I added a debugging line in the very beginning of it. Here is the nagios config for apache: AddType application/x-httpd-cgi .cgi ScriptAlias /nagios/cgi-bin/ /usr/lib/nagios/cgi/ Location /nagios/cgi-bin Options ExecCGI /Location Directory /usr/lib/nagios/cgi/ AllowOverride AuthConfig Options ExecCGI order deny,allow deny from all allow from ip_removed /Directory Alias /nagios/ /usr/share/nagios/ Directory /usr/share/nagios/ AllowOverride AuthConfig Options None order deny,allow deny from all allow from ip_removed /Directory use Apache::AuthDBI; any hints ? Thank you for your time. -- frankie
Re: binary cgi mess
Hi, Shouldn't it be AddHandler cgi-script .cgi Regards, Abdul-Wahid On Thu, 2003-03-13 at 10:53, Francesc Guasch wrote: I have a mod_perl server and I need to add a cgi application outside mod_perl, nagios. I followed the guide and when I try to use the cgis, the binary files are downloaded instead of executed. I tried the same in another apache server without Mason and it worked well. So I think something of my config must be messing it. I made sure the mason handler wasn't in the middle. I added a debugging line in the very beginning of it. Here is the nagios config for apache: AddType application/x-httpd-cgi .cgi ScriptAlias /nagios/cgi-bin/ /usr/lib/nagios/cgi/ Location /nagios/cgi-bin Options ExecCGI /Location Directory /usr/lib/nagios/cgi/ AllowOverride AuthConfig Options ExecCGI order deny,allow deny from all allow from ip_removed /Directory Alias /nagios/ /usr/share/nagios/ Directory /usr/share/nagios/ AllowOverride AuthConfig Options None order deny,allow deny from all allow from ip_removed /Directory use Apache::AuthDBI; any hints ? Thank you for your time. signature.asc Description: This is a digitally signed message part
[mp2] Subroutine calls in handlers
Hi - I'm a rookie; I'm developing a handler under mod_perl 1.99-09-dev (cvs) and Apache 2.0.44. The handler works w/o subs; but when I split it up with 'local' subroutines, as: # file:MyApache/Redirect.pm # --- package MyApache::Redirect; use strict; use warnings; use Apache::RequestRec (); use Apache::Log; use Apache::Const -compile = qw(DECLINED HTTP_MOVED_TEMPORARILY); sub handler { my $r = shift; [...] my $redirect = process_ssl ($uri); [...] } sub process_ssl { [...] } 1; My error-log shows: [Thu Mar 13 05:03:36 2003] [error] [client ::1] Undefined subroutine MyApache::Redirect::process_ssl called at /srv/www/perl/MyApache/Redirect.pm line 36. I'm missing something kind of basic here, but the examples on the mp2 site show handlers with subroutines (Eagle book too). Aloha = Beau;
Dual Processors Mod Perl
Hey ho, Sorry if this is an FAQ or a little OT.. We're thinking of moving a couple of servers and one of the possibilities is a dual PIII box (Compaq AFAIK, probably pretty standard rack box) I'm just wondering how Linux (RedHat 7.2) deals with dual processors, and whether any of the following will have problems: - Apache mod_perl themselves (currently use v1's rather than 2's) - LibXML,XSLT etc running under mod_perl - A whole bunch of CPAN mods! Does linux just take care of 2 proccessors or does the code have to be compatable? Also out of pure curiosity does it actually double the capabilities of the machine? (The jump from our current 128Mb to 1GB of RAM will - I'm guessing - have more of an impact ;-) Cheers.. Jimbo _ Jim Morrison Technology Development Partner Isotope Communications 9 Green Park Station Bath, BA1 1JB, UK +44 (0) 1225 444 674 http://www.mediaisotope.com/
Re: Dual Processors Mod Perl
I have have had about 50 dual CPU/1GB ram boxes running a combo of linux/freebsd over the least few years (20 currently). All running modperl/apache. I always go Dual-CPU. Its not that pricey. We have had no SMP problems at all and I think it performs much better, about 30% higher transaction rate. To me hte RAM is more important then the CPU dualism. But in general on a high volume system you are probably going to be more bound by Disk I/O etc then CPU. Our code base is pretty huge and we run more modules from CPAN then I can count including all the XML stuff ( LibXML, SOAP etc etc etc ). John- On Thu, 13 Mar 2003 15:15:34 - Jim Morrison [Mailing-Lists] [EMAIL PROTECTED] wrote: Hey ho, Sorry if this is an FAQ or a little OT.. We're thinking of moving a couple of servers and one of the possibilities is a dual PIII box (Compaq AFAIK, probably pretty standard rack box) I'm just wondering how Linux (RedHat 7.2) deals with dual processors, and whether any of the following will have problems: - Apache mod_perl themselves (currently use v1's rather than 2's) - LibXML,XSLT etc running under mod_perl - A whole bunch of CPAN mods! Does linux just take care of 2 proccessors or does the code have to be compatable? Also out of pure curiosity does it actually double the capabilities of the machine? (The jump from our current 128Mb to 1GB of RAM will - I'm guessing - have more of an impact ;-) Cheers.. Jimbo _ Jim Morrison Technology Development Partner Isotope Communications 9 Green Park Station Bath, BA1 1JB, UK +44 (0) 1225 444 674 http://www.mediaisotope.com/
Re: [mp2] Subroutine calls in handlers
On 13 Mar 2003 at 5:16, [EMAIL PROTECTED] wrote: Hi - I'm a rookie; I'm developing a handler under mod_perl 1.99-09-dev (cvs) and Apache 2.0.44. The handler works w/o subs; but when I split it up with 'local' subroutines, as: [...] *STUPID*STUPID*STUPID*STUPID*STUPID*STUPID* I had a compile error - please ignore :) All working now... Aloha = Beau;
Re: binary cgi mess
Abdul-wahid Paterson wrote: Hi, Shouldn't it be AddHandler cgi-script .cgi Well, thank you for trying. I replaced the line: AddType application/x-httpd-cgi .cgi for the one you told me, now the binary file isn't displayed in the browser, but it prompts me to download it. So it isn't executed in the server. I also tried to have both lines with the same results. On Thu, 2003-03-13 at 10:53, Francesc Guasch wrote: I have a mod_perl server and I need to add a cgi application outside mod_perl, nagios. I followed the guide and when I try to use the cgis, the binary files are downloaded instead of executed. -- frankie
RE: binary cgi mess
Are you sure your cgi program is executable by the user the server is running as? Regards, Ben Abdul-wahid Paterson wrote: Hi, Shouldn't it be AddHandler cgi-script .cgi Well, thank you for trying. I replaced the line: AddType application/x-httpd-cgi .cgi for the one you told me, now the binary file isn't displayed in the browser, but it prompts me to download it. So it isn't executed in the server. I also tried to have both lines with the same results. On Thu, 2003-03-13 at 10:53, Francesc Guasch wrote: I have a mod_perl server and I need to add a cgi application outside mod_perl, nagios. I followed the guide and when I try to use the cgis, the binary files are downloaded instead of executed. -- frankie
Compiling Apache::Scoreboard
Hi, I'm getting a bizarre compile error while trying to build Apache::Scoreboard 0.10 on a Mandrake Linux 9.0 system. Here's a snippet of make output, from the first gcc command that failed to just the first few errors it generates: gcc -c -I../ -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/include -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/regex -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/os/unix -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math -fno-strength-reduce -DVERSION=\0.04\ -DXS_VERSION=\0.04\ -fpic -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE -DPERL_THREADS DummyScoreboard.c In file included from DummyScoreboard.xs:14: /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl/mod_perl.h:261: parse error before '*' token /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl/mod_perl.h:261: warning: data definition has no type or storage class /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl/mod_perl.h:264: parse error before '*' token /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl/mod_perl.h:264: warning: data definition has no type or storage class And here's a snippet from mod_perl.h with line numbers: 256 257 typedef request_rec * Apache; 258 typedef request_rec * Apache__SubRequest; 259 typedef conn_rec* Apache__Connection; 260 typedef server_rec * Apache__Server; 261 typedef cmd_parms * Apache__CmdParms; 262 typedef TiedTable * Apache__Table; 263 typedef table * Apache__table; 264 typedef module * Apache__Module; 265 typedef handler_rec * Apache__Handler; 266 typedef command_rec * Apache__Command; 267 As you can see, the first two errors happen in the middle of pretty normal looking typedef statements. This was built using perl 5.8.0 (Mandrake's rpm), gcc 3.2 (Mandrake rpm again), and mod_perl 1.27 (compiled from source). I've talked to one other person who found the same errors on Red Hat 8.0, also using Red Hat's perl 5.8.0 and gcc 3.2 rpm's and a custom built mod_perl. Googling turned up someone from last fall with the same setup and problem, but no solution. Anyone else seen this? Other troubleshooting tips? Thanks in advance, Wes Sheldahl
Re: Doc clarifications requested
Stas Bekman wrote: Ron Savage wrote: I see this item: if one wishes to simply read POST data, there is the more modern {setup,should,get}_client_block API, and even more modern filter API. Along with continued support for read(STDIN, ...) and $r-read($buf, $r-headers_in-{'content-length'}) I feel the sentence stating with 'Along' should not belong under that dot point. Consider it as a footnote? Could put () around it I guess. Also, it's not a complete sentence, so what does it mean? what's not complete? Please be more explicit. He means that starting the sentence with Along with is not correct English usage. Try changing Along with to There is also. - Perrin
h2xs
I might be posting this to the wrong group, but any help would be appreciated. This is my problem, I am trying to use h2xs to create a extension for perl using an api provided by a 3rd party vendor. I have the .h,.so,.o files for their c libraries. I cannot figure out how to build the extension. I have not programmed in c for years and have forgotten all the secrets of it. I have gotten h2xs to run, but the function prototypes are not listed in the .xs file, but I am using the -x option which I think is supposed to do the trick. I have gotten make and make install to run, but when I try to test the module I am getting all kinds of errors about undefined symbols and such. Does anyone have any suggestions? Thanks, Blayne
how to make an Alias?
Hi list How do i make an alias on my webserver? i have images on my machine located in /home/me/images/. i would like to be able to access them on /home/httpd/htdocs/ i have tried this: Alias /home/me/images/ /home/httpd/htdocs/cctvimages/ i have mkdir cctvimages in /home/http/htdocs/cctvimages Regards, Mel P.S. i have Apache 1.3.27 _ Chat online in real time with MSN Messenger http://messenger.msn.co.uk
Re: how to make an Alias?
Hi, Alias /cctvimages/ /home/me/images/ Should do it. Regards, Abdul-Wahid On Thu, 2003-03-13 at 18:35, mel awaisi wrote: Hi list How do i make an alias on my webserver? i have images on my machine located in /home/me/images/. i would like to be able to access them on /home/httpd/htdocs/ i have tried this: Alias /home/me/images/ /home/httpd/htdocs/cctvimages/ i have mkdir cctvimages in /home/http/htdocs/cctvimages Regards, Mel P.S. i have Apache 1.3.27 _ Chat online in real time with MSN Messenger http://messenger.msn.co.uk signature.asc Description: This is a digitally signed message part
Re: CGI.pm and friends port to mp2
Hi Stas, Thanks. I'll fold these changes and release on CPAN. I'll also remove the $|=1 setting, since that was globally needed for FastCGI compatibility, and I don't think that anyone uses it anymore. Lincoln On Monday 10 March 2003 08:43 pm, Stas Bekman wrote: Hi Lincoln, I'm not interested in modifying CGI.pm to use MP2 until I start using MP2 myself. This isn't likely in the near future, since I'm very happy indeed with MP1/Apache1. I've done the porting of CGI.pm, CGI::Carp and CGI::Pretty (no more Apache/compat.pm). I did some basic testing, however it'd be nice if people were to test this patch and confirm that I didn't break anything that did work before. So that Lincoln doesn't have to figure out how to test it. I've attached the diff against 2.91 distro. One more thing, Lincoln, why CGI.pm does: $| = 1; without localizing the change, when running under mod_perl? This has a potentially bad effect on the rest of the modules running under the same server, since now every print() will flush the data. Can this setting be localized (this will probably require to move the unbuffering where it's relevant, rather than globally)? Thanks. __ 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 -- Lincoln D. Stein Cold Spring Harbor Laboratory [EMAIL PROTECTED] Cold Spring Harbor, NY
Does perl have Failover with Open Source Web Platforms?
My client is partial to perl so I installed mod_perl on Apache HTTPD on his windows servers. Now, however, he wants to price a linux cluster with raid to replace his windows servers. He needs declarative role based authorization and authentication for his web site -- and maybe fault tolerance too depending on the price of the hardware for a linux server. JBoss is cheap and open source with these features. My client, however, is partial to perl. How can we get perl with failover on a linux cluster? Also, what are your favorite hardware vendors for linux clusters? Thanks, Siegfried __ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com
Re: Does perl have Failover with Open Source Web Platforms?
On March 13, 2003 11:48 am, Richard Heintze wrote: My client is partial to perl so I installed mod_perl on Apache HTTPD on his windows servers. Now, however, he wants to price a linux cluster with raid to replace his windows servers. He needs declarative role based authorization and authentication for his web site -- and maybe fault tolerance too depending on the price of the hardware for a linux server. JBoss is cheap and open source with these features. And its java and may not perform as well as well formed mod_perl, but I'm probably opining from my impressions based on BEA on slowlaris compared to mod_perl on linux. My client, however, is partial to perl. How can we get perl with failover on a linux cluster? Lots of different ways. Depends on where you want the failover; If a 30 second delay is acceptable, even round robin dns forms a type of failover. If the first ip fails, the browser tries the second, etc. Then you separate application server from db, and put the db on some kind of redundancy/failover; like a app level retry list, a OS level failover, with proxy ARP and whatever to minimize downtime etc. An overview of OS level failover on linux: http://www.linuxvirtualserver.org/Documents.html So in summary, failover is a big fat word with lots of meaning. The faster you want it, the more money you spend. A 30 second failover was good enough for me, so I used round robin dns. Your mileage my vary. Also, what are your favorite hardware vendors for linux clusters? Whitebox hardware with name brand components, but I'm cheap. This is another question that is too broad. What level of service do you require? My local clone shop knows dick about linux but is happy to sell me machines with no OS loaded. You may want Scyld.com or one of the other cluster specialists if you are talking getting vendor expertise. They tend to focus on compute clusters, not web. -- Jay yohimbe Thorne [EMAIL PROTECTED] Mgr Sys Tech, Userfriendly.org
Re: CGI.pm and friends port to mp2
Lincoln Stein wrote: Hi Stas, Thanks. I'll fold these changes and release on CPAN. I'll also remove the $|=1 setting, since that was globally needed for FastCGI compatibility, and I don't think that anyone uses it anymore. Lincoln They have came out with a fastcgi (mod_fastcgi-2.4.0) release for httpd-2.0, so you might want to think about that. -- Brian Millett Enterprise Consulting Group Shifts in paradigms (314) 205-9030 often cause nose bleeds. [EMAIL PROTECTED] Greg Glenn
mod_perl not sending cookies
I'm using Apache:AuthCookie. I have set up a basic test site. It appears that AuthCookie never send the cookie even though the call to: $r-err_headers_out-add(Set-Cookie = $cookie); is there. If I modify the call to include a simple cookie: $r-err_headers_out-add(Set-Cookie = 'a=b'); it works. The value of $cookie is: jza70AuthHandler_JZA70=\Thisisatest\; expires=Tue, 11 Mar 2003 06:33:50 GMT; path=/thisisatest; domain=jza70 The expires field is from a log of a few days ago, but was valid (about 24 hours in the future) when it was sent. Any thoughts are apreciated. Andrew Fritz
Re: mod_perl not sending cookies
Are you using Apache::Cookie? If so, #same as $cookie-bake $r-err_headers_out-add(Set-Cookie = $cookie-as_string); Are you doing this? Richard. - Original Message - From: Andrew Fritz [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, March 13, 2003 8:24 PM Subject: mod_perl not sending cookies I'm using Apache:AuthCookie. I have set up a basic test site. It appears that AuthCookie never send the cookie even though the call to: $r-err_headers_out-add(Set-Cookie = $cookie); is there. If I modify the call to include a simple cookie: $r-err_headers_out-add(Set-Cookie = 'a=b'); it works. The value of $cookie is: jza70AuthHandler_JZA70=\Thisisatest\; expires=Tue, 11 Mar 2003 06:33:50 GMT; path=/thisisatest; domain=jza70 The expires field is from a log of a few days ago, but was valid (about 24 hours in the future) when it was sent. Any thoughts are apreciated. Andrew Fritz
RE: mod_perl not sending cookies
Usually when I have this problem the path and/or domain is incorrect. Try it without either. Tom -Original Message- From: Andrew Fritz [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2003 12:25 PM To: [EMAIL PROTECTED] Subject: mod_perl not sending cookies I'm using Apache:AuthCookie. I have set up a basic test site. It appears that AuthCookie never send the cookie even though the call to: $r-err_headers_out-add(Set-Cookie = $cookie); is there. If I modify the call to include a simple cookie: $r-err_headers_out-add(Set-Cookie = 'a=b'); it works. The value of $cookie is: jza70AuthHandler_JZA70=\Thisisatest\; expires=Tue, 11 Mar 2003 06:33:50 GMT; path=/thisisatest; domain=jza70 The expires field is from a log of a few days ago, but was valid (about 24 hours in the future) when it was sent. Any thoughts are apreciated. Andrew Fritz
Re: Does perl have Failover with Open Source Web Platforms?
Richard Heintze wrote: He needs declarative role based authorization and authentication for his web site -- and maybe fault tolerance too depending on the price of the hardware for a linux server. These are two separate things. Authen/Authz can be implemented any way you like on mod_perl. It does not impose an application structure. If you want an already built implementation, you could look at some of the many auth modules on CPAN or at OpenInteract which includes a user/group security model. For the CPAN list, start here: http://www.cpan.org/modules/00modlist.long.html#ID15_WorldWideW and look at the PerlAuthenHandler and PerlAuthzHandler modules. For failover, the question is what are you failing over? Any old load-balancer will give you failover between machines. Failing over your data is a matter of how you implement your application. I believe JBoss fails over session data. You get the same result with mod_perl if you store your session data in a database, using something like Apache::Session. Also, what are your favorite hardware vendors for linux clusters? Red Hat sells a software failover system that you can use, but most people just use a load-balancing switch like big/ip for this. No special hardware or software is required for that. - Perrin
RE: mod_perl not sending cookies
Andrew, Ya need to remember to CC the group as well. Copied from an oldish Netscape spec: -- domain=DOMAIN_NAME When searching the cookie list for valid cookies, a comparison of the domain attributes of the cookie is made with the Internet domain name of the host from which the URL will be fetched. If there is a tail match, then the cookie will go through path matching to see if it should be sent. Tail matching means that domain attribute is matched against the tail of the fully qualified domain name of the host. A domain attribute of acme.com would match host names anvil.acme.com as well as shipping.crate.acme.com. Only hosts within the specified domain can set a cookie for a domain and domains must have at least two (2) or three (3) periods in them to prevent domains of the form: .com, .edu, and va.us. Any domain that fails within one of the seven special top level domains listed below only require two periods. Any other domain requires at least three. The seven special top level domains are: COM, EDU, NET, ORG, GOV, MIL, and INT. The default value of domain is the host name of the server which generated the cookie response. path=PATH The path attribute is used to specify the subset of URLs in a domain for which the cookie is valid. If a cookie has already passed domain matching, then the pathname component of the URL is compared with the path attribute, and if there is a match, the cookie is considered valid and is sent along with the URL request. The path /foo would match /foobar and /foo/bar.html. The path / is the most general path. If the path is not specified, it as assumed to be the same path as the document being described by the header which contains the cookie. -Original Message- From: Andrew Fritz [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2003 7:07 PM To: Tom Murphy Subject: Re: mod_perl not sending cookies Bingo! That did it. I removed the path and domain and it works. No, the dumb questions: any idea what they should be set to to make it work. I'm testing with my hosts file modified to point to a local virtual host (jza70) instead of going to a real DNS accessable domain name (jza70.com). Is that the issue or am I missunderstanding what the domain field is specifying. I thought it specified the owner of the cookie. I'm not sure about the path field. Andrew Tom Murphy wrote: Usually when I have this problem the path and/or domain is incorrect. Try it without either. Tom -Original Message- From: Andrew Fritz [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2003 12:25 PM To: [EMAIL PROTECTED] Subject: mod_perl not sending cookies I'm using Apache:AuthCookie. I have set up a basic test site. It appears that AuthCookie never send the cookie even though the call to: $r-err_headers_out-add(Set-Cookie = $cookie); is there. If I modify the call to include a simple cookie: $r-err_headers_out-add(Set-Cookie = 'a=b'); it works. The value of $cookie is: jza70AuthHandler_JZA70=\Thisisatest\; expires=Tue, 11 Mar 2003 06:33:50 GMT; path=/thisisatest; domain=jza70 The expires field is from a log of a few days ago, but was valid (about 24 hours in the future) when it was sent. Any thoughts are apreciated. Andrew Fritz
Re: [mp2] Using DBI instead of Apache::DBI
[please keep the threads on the list unless requested otherwise] Georg Botorog wrote: Thanks. But I still have not understood how I avoid to include Apache::DBI in the current version of Apache (2). In mp1, there was an explicit inclusion statement in httpd.conf, which I could leave out. I have found nothing of the kind in mp2. Still, Apache::DBI is loaded. Maybe I have not expressed clearly: I do not want to unimport an included module, I simply do not want to include a special module, Apache::DBI, at all in a certain instance of Apache. What you are saying is that you don't load Apache::DBI, but something else does, right? Install this override at the very beginning of your startup.pl and watch the logs to see who loads Apache::DBI. *CORE::GLOBAL::require = sub { warn require $_[0]\n; CORE::require(@_) }; This should work with 5.6.x, not sure about earlier perl versions. -Original Message- From: Stas Bekman [SMTP:[EMAIL PROTECTED] Sent: Tuesday, March 11, 2003 11:55 PM To: Georg Botorog Cc: [EMAIL PROTECTED] Subject:Re: [mp2] Using DBI instead of Apache::DBI Georg Botorog wrote: Hello, In mod_perl1, using persistent (Apache::DBI) and dedicated, per-user connections (DBI) on the same machine required running two Apache instances, one with Apache::DBI and the other without it. Has anything about that changed in mod_perl2? Moreover, how does Apache2 know it has to load Apache::DBI? There is no PerlModule Apache::DBI statement in my httpd.conf (as it was under mp1), neither a use Apache::DBI in startup.pl or in any other module. Or, to put it the other way around: how can I avoid including Apache::DBI (in the DBI-only instance)? As you said Apache::DBI is either on or off and it will work just the same under mp2 as it does under mp1. However in the near future DBI is going to support pooling internally, which will take the benefit of threads if available. And I think it could be made more flexible than Apache::DBI, i.e. too be more than just on or off. I think Apache::DBI can do the same. What we really need is some sort of pragma where you can control Apache::DBI. e.g. let's say that once you load Apache::DBI it turns the pooling on globally. But than in your script you should be able to say (you can't do it just yet): no Apache::DBI; # which calls Apache::DBI::unimport $dbh = DBI-connect(...) and the unimport will restore the default DBI behavior for the scope of that pragma (e.g. handler) and restores to the previous behavior on the scope exit. Similar to how the warnings pragma works. It's be nice to have a generic pragma for turning any functionality on and off (do we have one already?). e.g. let's call it 'override': use override 'Apache::DBI'; # Apache::DBI overrides DBI here no override 'Apache::DBI'; # the previous functionality is restored (e.g. back to DBI) __ 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 -- __ 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: Doc clarifications requested
Perrin Harkins wrote: Stas Bekman wrote: Ron Savage wrote: I see this item: if one wishes to simply read POST data, there is the more modern {setup,should,get}_client_block API, and even more modern filter API. Along with continued support for read(STDIN, ...) and $r-read($buf, $r-headers_in-{'content-length'}) I feel the sentence stating with 'Along' should not belong under that dot point. Consider it as a footnote? Could put () around it I guess. Also, it's not a complete sentence, so what does it mean? what's not complete? Please be more explicit. He means that starting the sentence with Along with is not correct English usage. Try changing Along with to There is also. ah, of course, there should have been a comma, instead of a period. there is the more modern {setup,should,get}_client_block API, and even more modern filter API, along with continued support for read(STDIN, ...) and $r-read($buf, $r-headers_in-{'content-length'}). Thanks Perrin. __ 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: CGI.pm and friends port to mp2
Lincoln Stein wrote: Please find enclosed a beta version of CGI.pm 2.92. I would appreciate it if people could test it on both mod_perl 1 and mod_perl 2, as well as under normal CGI scripts too ;-) Thanks Lincoln. 'make test' passes with mp1 and mp2, however the test suites aren't exhaustively cover CGI.pm's functionality. So we really need your help guys to give it a good test in the real apps. In case anyone wonders why I fiddled with the check for the presence of modperl, this is because some people write scripts that shell out to command-line scripts that invoke CGI.pm in order to generate HTML (don't ask me why). Without the additional checking, CGI.pm sees the MODPERL environment variable, tries to load mod_perl outside the Apache environment, and summarily crashes. Ahm, I'm not quite sure that this does what you say it should: if (exists $ENV{MOD_PERL}) { require mod_perl; if (defined $mod_perl::VERSION ($mod_perl::VERSION = 1.99)) { # mp2 } else { # mp1 } } because if it's not defined, it'll fall through to the else block, assuming that the external script is running under mp1. Shouldn't it be: if (exists $ENV{MOD_PERL}) { require mod_perl; # mod_perl handlers may run system() on scripts using CGI.pm # - make sure so we don't get fooled by inherited $ENV{MOD_PERL} if (defined $mod_perl::VERSION){ # for shell scripts if ($mod_perl::VERSION = 1.99)) { # mp2 } else { # mp1 } } } also it's probably a good idea to add a note, why this check is done, so not to forget in the future and optimize it away ;) I still haven't heard any response as to why I should move to MP2! I wasn't just being cranky, I'm curious. You want to move to MP2, if one of the following reasons apply: - you are stuck with Apache2 - you want to use i/o filters - you want to write your own protocol handlers - you want to use a threaded mod_perl - you are stuck with win32 (mp1 is unusable on win32, serialization) and there is a whole bunch of new functionality available, which will be too long to list here and partially described on the website. __ 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: CGI.pm and friends port to mp2
Stas Bekman wrote: Lincoln Stein wrote: You want to move to MP2, if one of the following reasons apply: - you are stuck with Apache2 - you want to use i/o filters - you want to write your own protocol handlers - you want to use a threaded mod_perl - you are stuck with win32 (mp1 is unusable on win32, serialization) And you use IPv6 :) Carl
Re: CGI.pm and friends port to mp2
Stas Bekman wrote: Lincoln Stein wrote: Please find enclosed a beta version of CGI.pm 2.92. I would appreciate it if people could test it on both mod_perl 1 and mod_perl 2, as well as under normal CGI scripts too ;-) Thanks Lincoln. 'make test' passes with mp1 and mp2 Ah, no it doesn't pass 1.0 tests. I was too quick to post. I've replaced send_cgi_header with direct setting of $r-headers_out without doing the special handling for several headers. I'll revert it to use send_cgi_header. I thought we could get rid of this function, but it's better to keep it. __ 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: CGI.pm and friends port to mp2
Stas Bekman wrote: Stas Bekman wrote: Lincoln Stein wrote: Please find enclosed a beta version of CGI.pm 2.92. I would appreciate it if people could test it on both mod_perl 1 and mod_perl 2, as well as under normal CGI scripts too ;-) Thanks Lincoln. 'make test' passes with mp1 and mp2 Ah, no it doesn't pass 1.0 tests. I was too quick to post. I've replaced send_cgi_header with direct setting of $r-headers_out without doing the special handling for several headers. I'll revert it to use send_cgi_header. I thought we could get rid of this function, but it's better to keep it. Here is a new patch. I've attached it as well, in case it gets mangled. I've also incorporated the defined() fix that I've commented on earlier. Please check if that's what you meant. --- /tmp/CGI.pm-2.92/CGI.pm 2003-03-14 06:47:03.0 +1100 +++ /home/stas/perl/blead-ithread/lib/5.9.0/CGI.pm 2003-03-14 10:47:05.0 +1100 @@ -173,14 +173,18 @@ # Turn on special checking for Doug MacEachern's modperl if (exists $ENV{MOD_PERL}) { require mod_perl; - if (defined $mod_perl::VERSION ($mod_perl::VERSION = 1.99)) { -$MOD_PERL = 2; -require Apache::RequestRec; -require Apache::RequestUtil; -require APR::Pool; - } else { -$MOD_PERL = 1; -require Apache; + # mod_perl handlers may run system() on scripts using CGI.pm + # - make sure so we don't get fooled by inherited $ENV{MOD_PERL} + if (defined $mod_perl::VERSION) { +if ($mod_perl::VERSION = 1.99) { + $MOD_PERL = 2; + require Apache::RequestRec; + require Apache::RequestUtil; + require APR::Pool; +} else { + $MOD_PERL = 1; + require Apache; +} } } @@ -1320,21 +1324,12 @@ push(@header,map {ucfirst $_} @other); push(@header,Content-Type: $type) if $type ne ''; - if ($MOD_PERL and not $nph) { - my $r = Apache-request; - for (@header) { - my($k, $v) = split /:\s+/, $_, 2; - if ($k eq 'Content-Type') { - $r-content_type($v); - } - else { - $r-headers_out-{$k} = $v; - } - } -$r-send_http_header() if $MOD_PERL == 1; - return ''; - } -return join($CRLF,@header).${CRLF}${CRLF}; +my $header = join($CRLF,@header).${CRLF}${CRLF}; +if ($MOD_PERL and not $nph) { +Apache-request-send_cgi_header($header); +return ''; +} +return $header; } END_OF_FUNC __ 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 diff Description: application/java-vm
the deprecation of Apache-request in mp2
One more issue with CGI.pm and mp2, and other modules as well. CGI.pm is using Apache-request. The setting/retrieval of the global request record under threads is expensive, so the use of Apache-request is deprecated in mp2. If CGI.pm can be changed to optionally accept $r (as an argument to new(), plus a special accessor to set later) and use it instead, this will improve the performance if Apache-request is not set. Notice that it's the enabling of 'PerlOptions +GlobalRequest' (it's on by default with 'SetHandler perl-script') that is half of the performance hit (store), and the actual use of Apache-request (get) is the second half. See: http://perl.apache.org/docs/2.0/user/compat/compat.html#C_Apache_E_gt_request_ http://perl.apache.org/docs/2.0/user/config/config.html#C_GlobalRequest_ __ 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: h2xs
Blayne Bayer wrote: I might be posting this to the wrong group Have you tried searching for the right forum before posting here? In the future check this document first: http://perl.apache.org/docs/offsite/other.html Your XS questions probably belong here: http://lists.perl.org/showlist.cgi?name=perl-xs __ 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: Dual Processors Mod Perl
Jim Morrison [Mailing-Lists] wrote: [...] I'm just wondering how Linux (RedHat 7.2) deals with dual processors, [...] Does linux just take care of 2 proccessors or does the code have to be compatable? If you are using a non threaded mod_perl, which is the case with - mod_perl 1.0 - mod_perl w/ prefork mpm and you don't spawn your own threads, which you can. then your code will work all the same. The only difference is that if your code had any race conditions, chances are higher that you will hit them on a machine with more than one CPU. On race conditions see: http://perl.apache.org/docs/1.0/guide/debug.html#Critical_Section If you use mod_perl 2.0 w/ threaded mpm, your code and all libs that you use have to be re-entrant and thread-safe, no matter whether you are using a single- or multi-processor machine. Again if you code does have thread related problems, you are more likely to see them on an SMP machine. __ 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: Compiling Apache::Scoreboard
[EMAIL PROTECTED] wrote: Hi, I'm getting a bizarre compile error while trying to build Apache::Scoreboard 0.10 on a Mandrake Linux 9.0 system. Here's a snippet of make output, from the first gcc command that failed to just the first few errors it generates: gcc -c -I../ -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/include -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/regex -I/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/os/unix -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math -fno-strength-reduce -DVERSION=\0.04\ -DXS_VERSION=\0.04\ -fpic -I/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE -DPERL_THREADS DummyScoreboard.c In file included from DummyScoreboard.xs:14: /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl/mod_perl.h:261: parse error before '*' token /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl/mod_perl.h:261: warning: data definition has no type or storage class /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl/mod_perl.h:264: parse error before '*' token /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Apache/include/modules/perl/mod_perl.h:264: warning: data definition has no type or storage class I think this has to do with the ordering of including apache headers. This was fixed in the cvs version of mod_perl 1.0. Can you please try to rebuild mod_perl using the cvs version and then give another chance to Apache::Scoreboard? http://perl.apache.org/download/source.html#Development_Source_Distribution __ 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: mod_perl + GnuPG
Gareth Palmer wrote: I'm getting a strange error while trying to using the GnuPG module while running under mod_perl (everything works fine when executing from a shell) The message is: Can't locate object method OPEN via package Apache::RequestRec (perhaps you forgot to load Apache::RequestRec?) at /usr/lib/perl5/site_perl/5.6.3/GnuPG.pm line 252 mod_perl 1.99_08 OPEN was added after 1.99_08. Please build the cvs version of mod_perl 2.0: http://perl.apache.org/download/source.html#2_0_Development_Source_Distribution __ 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: PerlCleanupHandler firing too early?
Trey Hyde wrote: My PerlCleanupHandler seems to be firing before the content phase has finished processing the page. The handler pretty much looks like sub handler { my ($r) = @_; undef $Foo::bar; undef $Foo::baz; return OK; } It's being invoked in a virtual host apache conf segment with PerlCleanupHandler Apache::CleanupFoo If I don't comment out the PerlCleanupHandler line pieces of the application that rely on any variable that I undef in the Cleanup phase will crash. In the error log it doesn't _LOOK_ like the handler is being called early. The log yields exactly what I would expect it to. PID 1000 REWRITE CALLED initial: 1 main: 0 PID 1000 REWRITE CALLED initial: 0 main: 0 PID 1000 REWRITE CALLED initial: 0 main: 1 PID 1000 AUTHENTICATION CALLED BUNCH OF PERL ERRORS GO HERE (can't call method foo on undefined value and the like) PID 1000 REWRITE CALLED initial:0 main: 1 (rewriting /cgi-bin/error/error.pl) PID 1000 LOGGER CALLED (uri: error.pl) PID 1000 CLEANUP CALLED (uri: mod_perl app) I'm running on Apache/1.3.27 (Unix) mod_perl/1.26 w/ embperl 1.3.6. Does anyone have an idea of what is going on here (or what I'm doing wrong here?). Am I right in thinking that the CleanupHandler isn't supposed to have any effect on the code _running_ in the current or subsequent processes? In summary, leave Cleanup handler in everything that I undef in the cleanup handler gets undef'ed in the middle of running the code, if I removed the CleanupHandler the app works as intended. In the current request the CleanupHandler happens the last. You can visually see that using Apache::ShowRequest http://search.cpan.org/author/DOUGM/Apache-Module-0.11/lib/Apache/ShowRequest.pm However you don't show the code that you have the problem with, so certainly we have no clue why does it fail. If your cleanup handler affects global variable in the package, certainly you may have an impact on the subsequent requests running in the same process. If you still have this problem, reduce the problematic code to the very minimum (2-3 lines of code?), so that the problem can be still reproduced and post it here. __ 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: What does SetHandler do unexpectedly?
Frank Maas wrote: Hi, Well, by now you must know that I am working on something... and I keep stumbling on things I seem not to understand and not to be able to find in the docs / books. See this example: Location / # SetHandler perl-script PerlHeaderparserHandler MyClass-first PerlAuthenHandler MyAuthen PerlFixupHandler MyClass-init # PerlHandler MyClass-handler PerlCleanupHandler MyClass-last /Location I have stripped almost all functionality and just let the subroutines print. With this setup and a 'get http://mysite/dir/file' I see: -- first: got /dir/file authen: called for /dir/file init: called for /dir/file [error] ... /dir/file not found -- last: finished /dir/file No strange things, what I would expect. But now I remove the comments and see what happens: -- first: got /dir/file authen: called for /dir/file init: called for /dir/file authen: called for /file init: called for /file handler: called for /dir/file [error] ... /dir/file not found -- last: finished /dir/file What strike me are the two lines for /file. Why is this happening? I did not ask for it, at least not deliberately. Is this something that is related to a Handler (check one level below the uri)? Hope you can help me here (and on the other subjects...) Try to see if this helps: http://search.cpan.org/author/DOUGM/Apache-Module-0.11/lib/Apache/ShowRequest.pm We certainly can't guess what other handlers and configurations you may have that affect the process. it looks like something runs a sub-request, you may want to add to your authen handler an extra printout checking if it's inside a subrequest: warn $r-is_initial_req ? main req\n : sub req\n; it seems like your transhandler is returning DECLINED and Apache's default handler is running, trying to find /dir/file, and then trying /file. Or you may have something else. It's of no help to guess. __ 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