what is correct way to use mod_perl2, Apache2, and DBI?
Hey guys, mod_perl newbie here. Our web app was written a year ago as a regular CGI. Now that it gets accessed close to 1000 times a day (business grows) I saw the need to rewrite it using mod_perl2 as a "handler". I'm trying to use mod_perl-2.0.2 and apache 2.0.55. There isn't much documentation on mp2 as far as "what is right/standard" and google hasn't been much help so I've come here. I basically wanted to see if someone could 'glance over' my setup and offer any pointers. Also, if there is any documentation on how to correctly use Apache::DBI with mod_perl2 and apache2, that would be great cause even though I'm "use Apache::DBI", my connections aren't being cached. Technically, everything works fine: no perl warnings, pages load blazingly fast..except the DBI caching. Thanks alot. -Matthew Here's in my httpd.conf: -- PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off PerlRequire /home/someone/public_html/sec/startup.pl SetHandler perl-script PerlResponseHandler someone::v2 We make frequent modifications to the script so Apache2::Reload helps keep us from having to restart apache each time. My startup.pl --- use CGI; use Date::Format; use HTML::Template; use Time::HiRes qw(gettimeofday); use Apache2::RequestRec(); use Apache2::RequestIO(); use Apache2::Const -compile => ':common'; use Apache2::Cookie(); use lib qw(/home/someone/public_html/sec/); use Apache::DBI; // this aint working right 1; And inside someone/v2.pm -- package someone::v2; use strict; use warnings; use Apache2::Reload; use vars qw($q $r $dbh $template $sql); sub handler { $r = shift; $q = CGI->new(); .. DBI init..Template init.. return Apache2::Const::OK; } ..more subs..
Re: what is correct way to use mod_perl2, Apache2, and DBI?
First off, thanks for the replies from Perrin and Jonathan. Secondly, I wasn't using the newest Apache::DBI. I'm now using 0.991 and have the following in my startup.pl: use Apache::DBI; use DBI; Apache::DBI->connect_on_init("DBI:mysql:database=test;host=:/var/lib/mysql/mysql.sock;", "test", "test",{'RaiseError' => 1}); When I restarted apache, I looked in mysql and I see 10 connections (show processlist). I'm guessing 1 for each httpd process. Then inside my handler module I have this: sub handler { $r = shift; $q = CGI->new(); $dbh = DBI->connect_on_init("DBI:mysql:database=test;host=:/var/lib/mysql/mysql.sock;", "test", "test",{'RaiseError' => 1}); $dbh->{HandleError} = sub { &messageDie("A database error has occured.", shift, shift) }; ...code.. } I just ran a quick test using "ab" on another machine. I did 1000 requests and mysql constantly showed those same 10 connections. So I guess its working now. I've got 1 final problem with mod_perl2 but I'll use a different subject line so to start a new thread. Thanks again, Matthew Jonathan Vanasco wrote: On May 1, 2006, at 5:47 PM, Matthew wrote: use Apache::DBI; // this aint working right what's not working with it? generally I do this + Startup.pl Use Apache::DBI + DB.pl my%_db_config = ( dbType => 'postgresql', dbi => 'dbi:Pg:dbname=x', dbUser => 'x', dbPass => 'x', dbArgs => { RaiseError => 0, AutoCommit => 1 , TraceLevel => 0 }, ); Apache::DBI->connect_on_init( $_db_config{'dbi'}, $_db_config {'dbUser'}, $_db_config{'dbPass'}, $_db_config{'dbArgs'} ); sub dbconnect { $self->_dbconnect_real( \%_db_config ) } but i write mp handlers, you're just porting unless someone can chime in quick enough, i'd suggest looking to see where the first db connection is being instantiated. my guess from what you've written, is that you're connecting on the server startup (maybe in startup.pl somewhere?). once apache::DBI is loaded, it caches all connections - so you'll probably get worse performance with every request sharing 1 connection, than with every request making/breaking a new request. you want to make sure that you load Apache::DBI in startup.pl, but that you don't make any connections until you're in an apache request. | - - - - - - - - - - - - - - - - - - - - | RoadSound.com / Indie-Rock.net | Collaborative Online Management And Syndication Tools | - - - - - - - - - - - - - - - - - - - -
the dreaded 'subroutine redefined'
Hey gang, When I actually execute the code in web browser (http://www.mydomain.com/test/tester), I get this in my apache error_log: [Tue May 2 23:33:57 2006] v2.pm: Subroutine handler redefined at /home/me/public_html/confer//mypackage/tester.pm line 10. <..repeats for each subroutine in the file..> My httpd.conf section relating to mod_perl is thus: PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off PerlRequire /home/me/public_html/confer/startup.pl SetHandler perl-script PerlResponseHandler mypackage::tester Should I be doing "PerlModule mypackage::tester" above the section? Or doing "use mypackage::tester" inside startup.pl? I read something on google that says I should be using Apache::Symbol but I didn't see a mod_perl2 version of that. Thanks in advance, Matthew
Re: the dreaded 'subroutine redefined'
None of my subroutines are prototyped. They all follow the format: sub () { } Here are the first few lines of tester.pm and the code for the handler() function. -- package confer::tester; use strict; use warnings; use Apache2::Reload; use vars qw($q $r $dbh $template $sql); sub handler { $r = shift; $q = CGI->new(); # Instance the database connection and wrapper # messageDie as the fuction if something fails $dbh = DBI->connect("DBI:mysql:database=conf;host=:/tmp/mysql.sock;", "tester", "testerpass", {'RaiseError' => 1}); $dbh->{HandleError} = sub { &messageDie( "A database error has occured.", shift, shift) }; # We will always print out HTML $r->content_type("text/html"); # Instance the template object $template = new HTML::Template(filename => 'background.tpl', path => [ '/home/me/public_html/confer/' ], die_on_bad_params => 0, stack_debug => 0, debug => 0); # What are we going to do? my $cmd = (defined($q->param("_cmd")) ? $q->param("_cmd") : "logintype"); if($cmd eq "logintype") { &printLogin(); elsif($cmd eq "stats") { &printStats(); } else { &messageDie("How the frack did you get here?"); } return Apache2::Const::OK; } Thanks, Matthew Philip M. Gollucci wrote: PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlSetVar ReloadAll Off PerlRequire /home/me/public_html/confer/startup.pl SetHandler perl-script PerlResponseHandler mypackage::tester Can you show some of the file's sub foo { lines ? I've noticed Exporter doesn't always play nice if you protoype your functions sub foo ($@;\%) { Also, whether or not your preload your module in startup.pl or httpd.conf is merely a choice. You can tweak a couple things about the way PerlModule works via PerlOptions http://perl.apache.org/docs/2.0/user/config/config.html#C_AutoLoad_ HTH
Re: the dreaded 'subroutine redefined'
Nope. Didn't realize that () was prototyped. I should note that I pass variables to the functions like so: if($cmd eq "login") { &doLogin($q->param("username"), $q->param("password")); } sub doLogin() { my ($username, $password) = @_; if($username eq "you" && $password eq "me") { print "Success"; } else { print "Denied"; } } -Matthew Randal L. Schwartz wrote: "Matthew" == Matthew <[EMAIL PROTECTED]> writes: Matthew> None of my subroutines are prototyped. They all follow the format: Matthew> sub () { Matthew> Matthew> } You realize that's a prototype? :)
Re: the dreaded 'subroutine redefined'
I had a feeling it was Apache::Reload. In the future, we shouldn't need this module as we won't be making daily changes to the code. Thanks a million. -Matthew Perrin Harkins wrote: On Wed, 2006-05-03 at 16:48 -0400, Perrin Harkins wrote: On Tue, 2006-05-02 at 17:43 -0500, Matthew wrote: Hey gang, When I actually execute the code in web browser (http://www.mydomain.com/test/tester), I get this in my apache error_log: [Tue May 2 23:33:57 2006] v2.pm: Subroutine handler redefined at /home/me/public_html/confer//mypackage/tester.pm line 10. <..repeats for each subroutine in the file..> That's not a problem. This is just a warning telling you that Apache::Reload has reloaded your module and the sub was redefined. If it really bothers you, you can add a "no warnings (redefine)" to your version of Apache::Reload. Correction: Add "no warnings qw(redefine);" to your module. You shouldn't need to modify Apache::Reload. - Perrin
Sessions with mod_perl2
It could be that I just don't understand completely the nature of mod_perl, but here goes. Reason I'm confused is because there exists CGI::Cookie for handling cookies in MP2, but there's also the libapreq library "for MP2". It seems to me that the apreq lib is more "MP2 Native" than CGI would be. Am I wrong? Are they equally 'native' ? With that in mind, I'm looking for some module, that I'm sure exists, that can manage sessions. I found Apache::Session but I couldn't tell if it was MP2 native. Is there something else I should be using for sessions that is 'better' with MP2? Thanks, Matthew
Re: Apache2::reload?
My newbie response is that each Apache process makes its own compiled copy of the script. Say you have 5 apache processes. You load the page and see result X (handled by process #1). You make a change. You load the page and see result Y. (this time, handled by process #2). If process #2 has never loaded that script before, process #2 will compile the changed version and display that. You make another change and this time #1 handles it, but instead of seeing result Z, you see result X. -Matthew Dani Pardo wrote: Hi, I'm a little newbie, so please forgive me if the question is a bit lame. I've installed apache 2.0.58 with modperl 2.0.2 from source, and when I change a script on disk, the results get automatically reflected on the browser (I don't have to restart apache). I didn't setup Apache2::reload or anything like that. Is that normal? My apache conf is something like this: SetHandler perl-script PerlHandler ModPerl::Registry PerlResponseHandler ModPerl::Registry Options +ExecCGI PerlOptions -ParseHeaders PerlSendHeader Off Thanks!
Re: Apache2::reload?
a lot of people (ok, me) prefer to call every script in a startup.pl so it gets precached into the parent's shared memory i do it mainly with mp handler routines, but have done it with a few registry scripts How exactly to you do that? -Matthew
nothing vs Registry vs module
Firstly, real world comparison between no mod_perl and using Registry: Simple cgi, using Apache::DBI and CGI and HTML::Template. Loading 1 template file and doing about 30 template param replacements. Using "ab" to do 500 requests at 2 concurrents took about 47 seconds. Simply adding ModPerl::Registry to that directory and rebooting web server, results down to 2.3 seconds! Amazing. Secondly, seeing such a speed increase above makes me wonder the big differences between ModPerl::Registry and a handler module. Am I going to see an even more significant speed increase doing as a module? Thanks, Matthew
something is wrong. no differences with MP2
Hey gang, We are finally ready to move to our mod_perl2 handler. I just finished running some tests against our old CGI (no PerlRun, no Registry, just plain jane CGI). The results were basically the same. I did 500 requests, 2 concurents, and both scripts took about the same time. How can I find out what has happened? I just restarted apache too, to give the mod_perl version a clean recompile. Previous tests always showed at least a 50% speed increase over CGI. Is there some tool I can use to find out what has been added that is slowing down our mod_perl? Or any ideas what to look for first? Thanks, Matthew
CGI better than MP?
How could a CGI using ModPerl::Registry be faster than a Perl-Script running under mod_perl? When I say 'faster', I'm talking a few tenths of a second to half a second using Apache Benchmark (ab). What really gets the water boiling is that the CGI is coded 'worse' (ie: no strict, no warning, every var a global var, etc..). CGI even has a require on tools.pl, so total CGI is 1347 lines. module is 952 lines. CGI is not using DBI, nor ApacheDBI (its using some older mysql module). CGI is even using 3 extra modules that MOD is not. sniplets of my httpd.conf: -- StartServers10 MinSpareServers 10 MaxSpareServers 15 MaxClients 150 MaxRequestsPerChild 500 PerlRequire /home/drmac/public_html/secconf/startup.pl SetHandler perl-script PerlResponseHandler testPkg::v2 # This matches # http://www.mydomain.com/pages/sc2/roomlogin?roomID=3 Options +ExecCGI # This matches # http://www.mydomain.com/pages/sc2/roomlogin.cgi?roomID=3 SetHandler perl-script PerlResponseHandler ModPerl::PerlRun PerlOptions +ParseHeaders -- Proof is in the puddin': 5 Trials each of "ab -c 2 -n 500" Trial 1 CGI - 2.9265 Trial 2 CGI - 1.8933 Trial 3 CGI - 2.1517 Trial 4 CGI - 2.4451 Trial 5 CGI - 1.9838 Trial 1 MOD - 2.8199 Trial 2 MOD - 2.9183 Trial 3 MOD - 2.8225 Trial 4 MOD - 2.7791 Trial 5 MOD - 2.2639 At least the module is consistent in its performance. The CGI outputs 5378 bytes and the MOD outputs 5343, if that makes a difference. Just ran "ab -c 5 -n 1000" once on each and CGI still beat MOD by 0.6 seconds. Frustrated... -Matthew
Re: something is wrong. no differences with MP2
Both are reporting: Will look into Apache::DProf -Matthew Perrin Harkins wrote: On Mon, 2006-06-19 at 22:48 -0500, Matthew wrote: We are finally ready to move to our mod_perl2 handler. I just finished running some tests against our old CGI (no PerlRun, no Registry, just plain jane CGI). The results were basically the same. I did 500 requests, 2 concurents, and both scripts took about the same time. The most likely answer is that something is wrong with your configuration and both are running through the same CGI. You should try printing the value of $ENV{MOD_PERL} for both. Is there some tool I can use to find out what has been added that is slowing down our mod_perl? Apache::DProf - Perrin
[offtopic] perl newbie frustrated
Apologies for this being off-topic, but this is the best "perl resource" I have. I've been trying for the past 2 hours to get Frontier::Client working (XML-RPC). I originally tried RPC::XML but that dude's documentation was lacking some serious examples. So is F::C, but I found several HOWTO's and finally pieced that one together. I struggled over and over trying to get this client working. The PHP client was so, so simple. The call takes 3 args: userID, pass, and an array containing the course ID's to add you too. my @addUser = ( 332, 'mypass', (22, 74, 98)); Didn't work. It exploded the inner array into more params for the main array. I knew XMLRPC worked with array's and struct's but found no examples. Finally stumbled onto this and tried it: my @addUser = ( 332, 'mypass', [22, 74, 98]); Amazingly, that worked. I've never seen this type of [ ] notation so I tried it out: my $test = [2, 4, 8]; print $test; >Array(0x3038303) Oh? That's an array format. OK. Try this: my @test = (2, 4, 8); print @test; >248 ??? Confused. If anyone could please explain what I missed on the differences between ( ) array's and [ ] array's, I'd appreciate it. And for cookie points, if anyone knows how to do a real struct in XMLRPC, that would be awesome. Cheers, Matthew
duplicate trees, different handlers
Hey gang, happy friday! We have two trees for our web app: Prod -> /pages/sc2/roomlogin? PreProd -> /pages/sctest/roomlogin? httpd.conf: Location /pages/sc2/roomlogin -> /path/pages/sctest/omno/prod.pm Location /pages/sctest/roomlogin -> /path/pages/sctest/omno/preprod.pm After testing is done on preprod, we migrate from preprod to prod. The problem I am facing is that when we migrate, I have copy preprod.pm to prod.pm and make a change in the package name. I'm thinking if I change my @lib to one /path/pages/ then I can do something like this: SetHandler perl-script PerlResponseHandler sc2::omno::secconf SetHandler perl-script PerlResponseHandler sctest::omno::secconf Right? That way both perl files will have the same package (omno::secconf) but be in two separate locations to facilitate easy migration. Is my theory correct? If not, have others been in a situation like this? Any/all assistance is greatly appreciated. Thanks, Matthew
Re: libapreq test issues
I just tried using CPAN to install libapreq2.07 and I got this: cpan> install J/JO/JOESUF/libapreq2-2.07.tar.gz Running make for J/JO/JOESUF/libapreq2-2.07.tar.gz Fetching with LWP: CPAN.pm: Going to build J/JO/JOESUF/libapreq2-2.07.tar.gz perl: 5.8.0 ok mod_perl: 2.02 ok Apache::Test: 1.27 ok ExtUtils::MakeMaker: 6.30 ok ExtUtils::XSBuilder: 0.28 ok Test::More: 0.47 ok Use of uninitialized value in concatenation (.) or string at Makefile.PL line 86. ./configure --enable-perl-glue --with-apache2-apxs="" --with-perl="/usr/bin/perl" checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking whether make sets $(MAKE)... (cached) yes checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking for style of include used by make... GNU checking dependency style of gcc... gcc3 checking build system type... i686-pc-linux-gnu checking host system type... i686-pc-linux-gnu checking for a sed that does not truncate output... /bin/sed checking for egrep... grep -E checking for ld used by gcc... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking for /usr/bin/ld option to reload object files... -r checking for BSD-compatible nm... /usr/bin/nm -B checking whether ln -s works... yes checking how to recognise dependent libraries... pass_all checking how to run the C preprocessor... gcc -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking dlfcn.h usability... yes checking dlfcn.h presence... yes checking for dlfcn.h... yes checking for g++... g++ checking whether we are using the GNU C++ compiler... yes checking whether g++ accepts -g... yes checking dependency style of g++... gcc3 checking how to run the C++ preprocessor... g++ -E checking for g77... g77 checking whether we are using the GNU Fortran 77 compiler... yes checking whether g77 accepts -g... yes checking the maximum length of command line arguments... 32768 checking command to parse /usr/bin/nm -B output from gcc object... ok checking for objdir... .libs checking for ar... ar checking for ranlib... ranlib checking for strip... strip checking if gcc static flag works... yes checking if gcc supports -fno-rtti -fno-exceptions... yes checking for gcc option to produce PIC... -fPIC checking if gcc PIC flag -fPIC works... yes checking if gcc supports -c -o file.o... yes checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes checking whether -lc should be explicitly linked in... no checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes configure: creating libtool appending configuration tag "CXX" to libtool checking for ld used by g++... /usr/bin/ld checking if the linker (/usr/bin/ld) is GNU ld... yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking for g++ option to produce PIC... -fPIC checking if g++ PIC flag -fPIC works... yes checking if g++ supports -c -o file.o... yes checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes appending configuration tag "F77" to libtool checking if libtool supports shared libraries... yes checking whether to build shared libraries... yes checking whether to build static libraries... yes checking for g77 option to produce PIC... -fPIC checking if g77 PIC flag -fPIC works... yes checking if g77 supports -c -o file.o... yes checking whether the g77 linker (/usr/bin/ld) supports shared libraries... yes checking dynamic linker characteristics... GNU/Linux ld.so checking how to hardcode library paths into programs... immediate checking whether stripping libraries is possible... yes checking for ranlib... (cached) ranlib checking for a BSD-compatible install... /usr/bin/install -c checking whether ln -s works... yes checking whether to enable maintainer-specific portions of Makefiles... no ./configure: line 1: -q: command
Re: acceptable memory leaks?
> Memory is cheap / CPU is cheap My boss makes this same argument and I hate it. Wasting is still wasting. -Matthew
RE: [OT] [mod_perl] [Fun] telecommuting job
Slava: Are you an idiot? Just Joking, Matt (Sorry, couldn't resist :) > -Original Message- > From: Slava Bizyayev [mailto:[EMAIL PROTECTED] > Sent: Friday, December 12, 2003 3:31 PM > To: Haroon Rafique > Cc: 'mod_perl list' > Subject: RE: [OT] [mod_perl] [Fun] telecommuting job > > > "...When you have no sense of humor, you have to have at > least a sense that you have no sense of humor..." > (Russian source: Kos'ma Prutkov -Aphorisms; > translated by Slava Bizyayev) > > > > Dear Haroon and Jonathan, > > I like Christmas. It's the time when miracles used to happen > in the World. And they really happen when you are capable of > seeing them. > > We have nothing to discuss here. The story was not about the > job; It was about a Christmas miracle that you might > see/believe or not. > > Thanks, > Slava > > > > -- > Reporting bugs: http://perl.apache.org/bugs/ > Mail list info: http://perl.apache.org/maillist/modperl.html > > -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
[mp2] build problem mod_perl-1.99_12 and "make install DESTDIR"
If you build apache with ./configure \ --prefix=/kinnetics/component/httpd make install DESTDIR=/tmp/apache-kinnetics-$USER then when you try compiling mod_perl you get: perl Makefile.PL \ MP_AP_PREFIX=/tmp/apache-kinnetics-$USER/kinnetics/component/httpd \ LIB=/tmp/apache-kinnetics-$USER/kinnetics/component/httpd/site_perl \ PREFIX=/tmp * WARNING * !!! '/tmp/apache-kinnetics-darwin/kinnetics/component/httpd/bin/apxs -q INCLUDEDIR' failed: !!! cannot open /kinnetics/component/httpd/build/config_vars.mk: No such file or directory at /tmp/apache-kinnetics-darwin/kinnetics/component/httpd/bin/apxs line 256. Note that this works just fine under mod_perl 1.99_10-dev. -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: [mp2] build problem mod_perl-1.99_12 and "make install DESTDIR"
Also works under 1.99_11 BTW, my perl version is 5.8.1 and apache 2.0.48. Matthew Darwin wrote: Note that this works just fine under mod_perl 1.99_10-dev. -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: [mp2] build problem mod_perl-1.99_12 and "make install DESTDIR"
Well, presumably it points to the directory where it gets installed. However, I haven't installed it yet because I need to compile mod_perl. (My runtime machine doesn't have a compiler). If that variable is changed, then how would apxs find things after I tar it up (not that I use it after it is in the correct location). I'm happy to open a apache bug. http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26076 Stas Bekman wrote: Matthew Darwin wrote: If you build apache with ./configure \ --prefix=/kinnetics/component/httpd make install DESTDIR=/tmp/apache-kinnetics-$USER When you do that, does apxs get affected? i.e. does it get all the directories adjusted. If not (which I suppose is the case) it's a bug in httpd build. You should report it to httpd as: I did: ./configure --prefix=/kinnetics/component/httpd make install DESTDIR=/tmp/apache-kinnetics-$USER but apxs still points to the old location: /tmp/apache-kinnetics-darwin/kinnetics/component/httpd/bin/apxs -q INCLUDEDIR' failed: !!! cannot open /kinnetics/component/httpd/build/config_vars.mk: No such file or directory at /tmp/apache-kinnetics-darwin/kinnetics/component/httpd/bin/apxs line 256. unless it's documented to behave this way then when you try compiling mod_perl you get: perl Makefile.PL \ MP_AP_PREFIX=/tmp/apache-kinnetics-$USER/kinnetics/component/httpd \ LIB=/tmp/apache-kinnetics-$USER/kinnetics/component/httpd/site_perl \ PREFIX=/tmp * WARNING * !!! '/tmp/apache-kinnetics-darwin/kinnetics/component/httpd/bin/apxs -q INCLUDEDIR' failed: !!! cannot open /kinnetics/component/httpd/build/config_vars.mk: No such file or directory at /tmp/apache-kinnetics-darwin/kinnetics/component/httpd/bin/apxs line 256. Note that this works just fine under mod_perl 1.99_10-dev. right, we just didn't use apxs in earlier versions (and the build couldn't handle this situation). mod_perl relies on a working apxs. If that's broken it needs to be fixed. __ 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 -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
[mp1] RH9 / apache 1.3.29 / mod_perl 1.29 / perl 5.8.0 segfault
Hi Folks, This one has me stumped. After installing with clean tarballs of apache_1.3.29 and mod_perl-1.29 on a RedHat 9 box, I'm getting a segfault upon making a request. I'm not executing any perl handler at all - in fact, none are configured in my httpd.conf. I'm just requesting a file. The error log reports the following: [notice] child pid 10570 exit signal Segmentation fault (11) I searched the archives, and this one looked relatively close in comparison: http://www.gossamer-threads.com/perl/mailarc/gforum.cgi?post=85025; search_string=apaci%201.29;guest=2149190&t=search_engine Here is my installation procedure after untarring apache/mod_perl, which follows the docs at: http://perl.apache.org/docs/1.0/guide/install.html#The_Flexible_Way ... since at some point i want to incorporate PHP and DAV into the build. > perl Makefile.PL PERL_DEBUG=1 APACHE_SRC=../apache_1.3.29/src NO_HTTPD=1 USE_APACI=1 PREP_HTTPD=1 ALL_HOOKS=1 PERL_URI_API=1 PERL_UTIL_API=1 PERL_TABLE_API=1 > make > make install Now I cd into the apache source tree and run: > ./configure --prefix=/data/httpd --activate-module=src/modules/perl/libperl.a --enable-module=most > make > make install When I use this httpd, i get the segfault (details below). However, if change my Makefile.PL args to build httpd (add DO_HTTPD=1, APACHE_PREFIX=/data/httpd, AND remove PREP_HTTPD=1), and run make install from the mod_perl distribution directory, the resulting httpd works properly. Could this be an apache 'make' issue? Here is my gdb backtrace ... I'm not sure why I get the 'no debugging symbols found' warning, as I asked for debugging symbols in my MakeFile.pl args (I'm not much of a gdb user, if you couldn't tell) > gdb httpd (gdb) run -X -f /data/httpd/conf/httpd.conf Starting program: /data/httpd/bin/httpd -X -f /data/httpd/conf/httpd.conf (no debugging symbols found)...(no debugging symbols found)... Program received signal SIGSEGV, Segmentation fault. 0x0806fafe in perl_header_parser () (gdb) bt #0 0x0806fafe in perl_header_parser () #1 0x080a8591 in ap_cleanup_method_ptrs () #2 0x080a868b in ap_header_parse () #3 0x080bd0a6 in ap_some_auth_required () #4 0x080bd41a in ap_process_request () #5 0x080b45ef in ap_child_terminate () #6 0x080b4790 in ap_child_terminate () #7 0x080b48f7 in ap_child_terminate () #8 0x080b4f96 in ap_child_terminate () #9 0x080b57b4 in main () #10 0x40214907 in __libc_start_main () from /lib/libc.so.6 Here is my perl -V (its redhat rpm perl-5.8.0-88.3): Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.4.21-1.1931.2.382.entsmp, archname=i386-linux-thread-multi uname='linux stripples.devel.redhat.com 2.4.21-1.1931.2.382.entsmp #1 smp wed aug 6 17:18:52 edt 2003 i686 i686 i386 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 -Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.0 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -march=i386 -mcpu=i686', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='3.2.2 20030222 (Red Hat Linux 3.2.2-5)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt -lutil perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.0/i386-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this bi
[MP2] "here" documents and UTF-8 and output filters
I'm not sure if anyone has noticed this, so I thought I'd post. If I create a string using here syntax: my $string < And $string contains UTF-8 characters they get mangled somehow when they go through the output chain. However, if I build the same document using my $string; $string .= "..." $string .= "..." $string .= "..." print $string; Then everything is good. Thoughts? Linux Perl 5.8.1 (RedHat 9) Note that this program generates the same results (mod the extra \n): #!/usr/bin/perl -w my $fh; open ($fh, "<", "utf8french.txt") || die; my $stuff = <$fh>; close ($fh); print $stuff; print < -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: [MP2] "here" documents and UTF-8 and output filters
Stas Bekman wrote: Can you reproduce this problem outside of mp2? just a plain perl program? No. Any difference if you add: use Apache::RequestIO (); binmode(STDOUT, ':utf8'); # Apache::RequestRec::BINMODE() Yes, I get different garbage. before you do the print. Or if you use $r->print() instead? No difference. -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: [MP2] "here" documents and UTF-8 and output filters
Stas Bekman wrote: Matthew Darwin wrote: Stas Bekman wrote: Ah, I suppose this is a typing error: > my $string < ... > ... > EOF > print $string; you miss '=' Sorry... writing up exmaples has inherent dangers. Also try adding utf8::encode($string); Tried that already. No help. -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: [RELEASE CANDIDATE] please test mod_perl-1.99_13-dev.tar.gz
I'll be using .12 in production in 3 weeks. Just running tests now. Stas Bekman wrote: Charlie Smith wrote: Is this the mod_perl version we should be using with Apache 2 then? Yes. Assuming all tests go well? Yes What is fate of mp2 at this time? Once the API is frozen and documented, and this todo list [1] is cleaned up we will release 2.0. You can help to make this happen earlier. Is it near production level yet? Most like yes, but no guarantees are available. Check for yourself, see if it's ready or not and report back success/failures. [1] http://cvs.apache.org/viewcvs.cgi/modperl-2.0/todo/release?rev=1.19&view=markup __ 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 -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: [mp2] ?Any clue when stable release comes out?
I'm also using it in production as of yesterday. % HEAD http://nddemo.peregrine.com 200 OK Connection: close Server: Apache/2.0.49 (Unix) mod_perl/1.99_14 Perl/v5.8.3 DAV/2 ... Bart Simpson wrote: Starting a project expected to be done by Xmas. Its billing software for a small ISP. Will a production release of MP2 be out by then or when does anyone have an idea when one will be out?? Much thanks, __ Do you Yahoo!? Read only the mail you want - Yahoo! Mail SpamGuard. http://promotions.yahoo.com/new_mail -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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
mp2: PerlSetVar not working?
I can't figure out what I'm doing wrong. I'm trying to pass a value from httpd.conf to the module I know this used to work in mp1, but I can't seem to get it to work in mp2 Ideas? Thanks. httpd.conf -- PerlModule Apache::Foo SetHandler perl-script PerlResponseHandler Apache::Foo PerlSetVar FooValue FooBarBaz Apache/Foo.pm - package Apache::Foo; use Apache::Const -compile => ':common'; use Apache::ServerUtil (); sub handler { my ($r) = @_; warn "Value of Foo is 1: ", $r->server->dir_config ("FooValue"), "\n"; warn "Value of Foo is 2: ", $r->dir_config ("FooValue"), "\n"; return Apache::DECLINED; } httpd.error --- [Mon Jul 05 20:13:12 2004] [notice] Apache/2.0.49 (Unix) mod_perl/1.99_14 Perl/v5.8.3 DAV/2 configured -- resuming normal operations [Mon Jul 5 20:13:12 2004] -e: Authd: Opening connection [Mon Jul 5 20:13:12 2004] -e: Use of uninitialized value in warn at .../site_perl/Apache/Foo.pm line 9, line 2. [Mon Jul 5 20:13:12 2004] -e: Value of Foo is 1: [Mon Jul 5 20:13:12 2004] -e: Use of uninitialized value in warn at .../site_perl/Apache/Foo.pm line 10, line 2. [Mon Jul 5 20:13:12 2004] -e: Value of Foo is 2: [Mon Jul 05 20:13:12 2004] [error] [client 1.2.3.4] File does not exist: .../htdocs/nm/foo -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: mp2: PerlSetVar not working?
The behaviour is consistantly wrong at least... [Tue Jul 06 18:38:36 2004] [notice] Apache/2.0.49 (Unix) mod_perl/1.99_14 Perl/v5.8.3 DAV/2 configured -- resuming normal operations [Tue Jul 6 18:38:42 2004] -e: Authd: Opening connection [Tue Jul 6 18:38:42 2004] -e: Use of uninitialized value in concatenation (.) or string at /kinnetics/component/perllib/site_perl/Apache/Foo.pm line 7, line 2. [Tue Jul 06 18:38:42 2004] [warn] [client 10.2.210.1] Value of Foo is: \n Randy Kobes wrote: On Mon, 5 Jul 2004, Matthew Darwin wrote: I can't figure out what I'm doing wrong. I'm trying to pass a value from httpd.conf to the module I know this used to work in mp1, but I can't seem to get it to work in mp2 Ideas? Thanks. httpd.conf -- PerlModule Apache::Foo SetHandler perl-script PerlResponseHandler Apache::Foo PerlSetVar FooValue FooBarBaz Apache/Foo.pm - package Apache::Foo; use Apache::Const -compile => ':common'; use Apache::ServerUtil (); sub handler { my ($r) = @_; warn "Value of Foo is 1: ", $r->server->dir_config ("FooValue"), "\n"; warn "Value of Foo is 2: ", $r->dir_config ("FooValue"), "\n"; return Apache::DECLINED; } If it's just to see if the values are being accessed OK, how about the following: === package Apache::Foo; use Apache::Const -compile => ':common'; use Apache::RequestUtil (); sub handler { my ($r) = @_; $r->log->warn("Value of Foo is: " . $r->dir_config ("FooValue") . "\n"); return Apache::OK; } 1; == -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: mp2: PerlSetVar not working?
Ok, I removed this section of httpd.conf, I start seeing output from your script: $Location{"/nm"} = { AuthType => 'Basic', AuthName => '"' . $Kinnetics::Constants::LOGIN_PROMPT . '"', PerlAuthenHandler => 'Apache::Kinnetics::Authenticate', PerlAuthzHandler => 'Apache::Kinnetics::Authorize', 'require' => 'valid-user' }; Geoffrey Young wrote: Matthew Darwin wrote: The behaviour is consistantly wrong at least... [Tue Jul 06 18:38:36 2004] [notice] Apache/2.0.49 (Unix) mod_perl/1.99_14 Perl/v5.8.3 DAV/2 configured -- resuming normal operations [Tue Jul 6 18:38:42 2004] -e: Authd: Opening connection [Tue Jul 6 18:38:42 2004] -e: Use of uninitialized value in concatenation (.) or string at /kinnetics/component/perllib/site_perl/Apache/Foo.pm line 7, line 2. [Tue Jul 06 18:38:42 2004] [warn] [client 10.2.210.1] Value of Foo is: \n I can't reproduce your problem. please try this self-contained tarball with a recent mod_perl (preferably the latest release, 1.99_14): http://perl.apache.org/~geoff/perlsetvar-bug-mp2.tar.gz if the test fails for you, please file an official bug report as described here: http://perl.apache.org/bugs/ if the test passes but you still are having problems, you may want to slowly adjust the tarball until you have a reproducable test case that we can investigate. --Geoff -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: mp2: PerlSetVar not working?
What is the output of that script supposed to look like? Without doing anything I have issues: [EMAIL PROTECTED]:~# tar -xzf perlsetvar-bug-mp2.tar.gz [EMAIL PROTECTED]:~# cd perlsetvar-bug-mp2 [EMAIL PROTECTED]:~/perlsetvar-bug-mp2# perl Makefile.PL Checking if your kit is complete... Looks good Writing Makefile for perlsetvar-bug [EMAIL PROTECTED]:~/perlsetvar-bug-mp2# ./t/TEST -conf [warning] setting ulimit to allow core files ulimit -c unlimited; /usr/bin/perl /data1/system/root/perlsetvar-bug-mp2/t/TEST -conf [warning] cleaning out current configuration [ error] configure() has failed: find_apache_module: module name argument is required at /kinnetics/component/httpd/site_perl/i386-linux-thread-multi/Apache/TestConfig.pm line 702. [warning] forcing Apache::TestConfig object save [warning] run 't/TEST -clean' to clean up before continuing [EMAIL PROTECTED]:~/perlsetvar-bug-mp2# BTW, I emptied the Authentication and Authorization handlers and it still fails using my original test. --- package Apache::Kinnetics::Authenticate; use strict; use Apache::Const -compile => ':common'; sub handler { return Apache::OK; } 1; --- package Apache::Kinnetics::Authorize; use strict; use Apache::Const -compile => ':common'; sub handler { return Apache::OK; } 1; Geoffrey Young wrote: Matthew Darwin wrote: Ok, I removed this section of httpd.conf, I start seeing output from your script: ... ok, that's a start :) there are really too many variables at this point for me to figure out what you are trying to do. if you could adjust t/conf/extra.conf.in in small increments until t/bug.t fails it would help isolate the issue. after each adjustment, don't forget to run $ t/TEST -conf so that your changes to t/conf/extra.conf.in are recognized. --Geoff -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: mp2: PerlSetVar not working?
Nope. Turned off it is the same. I can upgrade to httpd-2.0.50 if that helps... I already have it compiled. Randy Kobes wrote: On Tue, 6 Jul 2004, Matthew Darwin wrote: The behaviour is consistantly wrong at least... [Tue Jul 06 18:38:36 2004] [notice] Apache/2.0.49 (Unix) mod_perl/1.99_14 Perl/v5.8.3 DAV/2 configured -- resuming normal operations [ ... ] Does anything change if you disable DAV/2? -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: mp2: PerlSetVar not working?
I know, being logged in as root is bad... however this is a test server... if anything goes bad, insert the cd and reboot and we're back in business in 20 minutes. Thanks for the suggestion, it still is not helping. I'm probably missing some config file or something. I build on a separate server and tar everything up and bring it over here to test on. [EMAIL PROTECTED]:~# rm -r perlsetvar-bug-mp2 [EMAIL PROTECTED]:~# tar -xzf perlsetvar-bug-mp2.tar.gz [EMAIL PROTECTED]:~# cd perlsetvar-bug-mp2 [EMAIL PROTECTED]:~/perlsetvar-bug-mp2# perl Makefile.PL -axps `which apxs` Checking if your kit is complete... Looks good Writing Makefile for perlsetvar-bug [EMAIL PROTECTED]:~/perlsetvar-bug-mp2# make [EMAIL PROTECTED]:~/perlsetvar-bug-mp2# make test /usr/bin/perl -Iblib/arch -Iblib/lib \ t/TEST -clean [warning] setting ulimit to allow core files ulimit -c unlimited; /usr/bin/perl /data1/system/root/perlsetvar-bug-mp2/t/TEST -clean APACHE_TEST_GROUP= APACHE_TEST_HTTPD= APACHE_TEST_PORT= APACHE_TEST_USER= APACHE_TEST_APXS= \ /usr/bin/perl -Iblib/arch -Iblib/lib \ t/TEST -bugreport -verbose=0 [warning] setting ulimit to allow core files ulimit -c unlimited; /usr/bin/perl /data1/system/root/perlsetvar-bug-mp2/t/TEST -bugreport -verbose=0 [ error] configure() has failed: find_apache_module: module name argument is required at /kinnetics/component/httpd/site_perl/i386-linux-thread-multi/Apache/TestConfig.pm line 702. [warning] forcing Apache::TestConfig object save [warning] run 't/TEST -clean' to clean up before continuing make: *** [run_tests] Error 1 [EMAIL PROTECTED]:~/perlsetvar-bug-mp2# which apxs /kinnetics/component/httpd/bin/apxs [EMAIL PROTECTED]:~/perlsetvar-bug-mp2# Meanwhile, I changed the section from my previous e-mail to, and I get the same results as if it were in the section. Commenting out those lines make it work. AuthName "foobar" AuthType Basic Require valid-user PerlAuthenHandler Apache::Kinnetics::Authenticate PerlAuthzHandler Apache::Kinnetics::Authorize My build.pl looks like this: cd apache ./configure \ --prefix=/kinnetics/component/httpd \ --with-mpm=prefork \ --enable-rewrite=shared \ --enable-auth=shared \ --enable-cgi=shared \ --enable-alias=shared \ --enable-proxy=shared \ --enable-autoindex=shared \ --enable-setenvif=shared \ --enable-status \ --enable-dav=shared \ --enable-dav_fs=shared \ --disable-asis \ --disable-imap \ --disable-userdir \ --disable-negotiation \ --disable-include \ --disable-env make make install DESTDIR=/tmp/apache-kinnetics-$USER make clean cd .. cd mod_perl perl Makefile.PL MP_AP_PREFIX=/tmp/apache-kinnetics-$USER/kinnetics/component/httpd \ LIB=/tmp/apache-kinnetics-$USER/kinnetics/component/httpd/site_perl \ PREFIX=/tmp make make test make install cd .. -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: mp2: PerlSetVar not working?
me=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dpager=/usr/bin/less -isr -Dinc_version_list=5.8.2 5.8.1 5.8.0' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -march=i386 -mcpu=i686', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='3.3.2 20031218 (Red Hat Linux 3.3.2-5)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.3/i386-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under linux Compiled at Feb 25 2004 13:30:53 %ENV: PERL5LIB="/usr/local/perl5/site_perl" PERL_LWP_USE_HTTP_10="1" @INC: /usr/local/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/local/perl5/site_perl/5.8.3 /usr/local/perl5/site_perl/i386-linux-thread-multi /usr/local/perl5/site_perl/5.8.2 /usr/local/perl5/site_perl/5.8.1 /usr/local/perl5/site_perl/5.8.0 /usr/local/perl5/site_perl /usr/lib/perl5/5.8.3/i386-linux-thread-multi /usr/lib/perl5/5.8.3 /usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.3 /usr/lib/perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl . *** Packages of interest status: Apache::Request: - CGI: 3.01 LWP: 5.65 mod_perl : - 3. This is the core dump trace: (if you get a core dump): [CORE TRACE COMES HERE] This report was generated by ./REPORT on Thu Jul 8 01:12:39 2004 GMT. -8<-- End Bug Report --8<-- Note: Complete the rest of the details and post this bug report to dev perl.apache.org. To subscribe to the list send an empty email to [EMAIL PROTECTED] Geoffrey Young wrote: [ error] configure() has failed: find_apache_module: module name argument is required at /kinnetics/component/httpd/site_perl/i386-linux-thread-multi/Apache/TestConfig.pm line 702. hmm, this is strange - unrelated to the PerlSetVar issue, but an issue with Apache-Test for sure :) to continue, I'll need you to update to at least the latest Apache-Test - it's available on CPAN. or you can use mod_perl 1.99_14 which contains the latest Apache-Test in it. updating your mod_perl is a good idea anyway, since we'll need to prove the PerlSetVar bug is present in the current version in order to fix it ;) after upgrading Apache-Test, if you still get configuration errors when running 'make test' try doing this $ export APACHE_TEST_TRACE_LEVEL=debug and post the verbose output back here. also, please run t/REPORT so we can find out what your system looks like. --Geoff -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: [mp2] how far off feature-freeze is mp2?
I'm using mp2 production now. http://demo:[EMAIL PROTECTED] Server: Apache/2.0.50 (Unix) mod_perl/1.99_14 Perl/v5.8.3 DAV/2 Carl Brewer wrote: Hello Stas et al, Just a quick question; how far off a feature-freeze is MP2? ie: if I wanted to write a moderatly serious e-commerce app in mp, is it safe to use mp2 and apreq2? thanks! Carl -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: [mp2] how far off feature-freeze is mp2?
Scott Fagg wrote: Server: Apache/2.0.50 (Unix) mod_perl/1.99_14 Perl/v5.8.3 DAV/2 It would appear your using mp 1.99_14, which i thought was a pre-release version, and not the first official release of mp2? Yes, it is a pre-release version. The point is that it is stable enough to use in an enterprise (fortune 500 company) application. 1.99_14 was the latest available at the time the product went into feature-freeze. -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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: [mp2] how far off feature-freeze is mp2?
Scott Fagg wrote: Yes, it is a pre-release version. The point is that it is stable enough to use in an enterprise (fortune 500 company) application. Is stable a reference to crashing or changes in the API ? Crashing. I'm using a later version, 1.99_16, because the version that shipped with FC2, 1.99_12, was missing APIs (something to do with buckets) that are referred to on the modperl website and that i was trying to use. 1.99_12 was missing stuff I needed as well. Everything I need seems to be in 1.99_14 except a fix for a bug related to merging of Perl configuration sections, which I reported to this list. -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- 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
brand new staticised mod_perl 1.99.16 / apache 2.0.51 segfaults.
-8<-- Start Bug Report 8<-- 1. Problem Description: On a plain boring box running debian stable, the simplest build of apache 2.0.51 with a static linked mod_perl 1.99.16 segfaults immediately on start. I've been running round in circles on this all evening, any assistance would be hugely appreciated. :( The entire install was built by downloading & expanding apache & mod_perl, and then running: $ perl Makefile.PL \ MP_AP_PREFIX=../httpd-2.0.51/ \ MP_AP_BUILD=1 \ MP_DEBUG=1 \ MP_INST_APACHE2=1 \ MP_AP_CONFIGURE="--enable-maintainer-mode --prefix=/usr/local/apache2 --localstatedir=/var/run/apache2 --with-mpm=prefork" $ make # make install $ make test in the mod_perl source tree. 2. Used Components and their Configuration: *** mod_perl version 1.9916 *** using /usr/local/src/web/apache2/mod_perl-1.99_16/lib/Apache/BuildConfig.pm *** Makefile.PL options: MP_APR_LIB => aprext MP_AP_BUILD => 1 MP_AP_CONFIGURE => --enable-maintainer-mode --prefix=/usr/local/apache2 --localstatedir=/var/run/apache2 --with-mpm=prefork MP_AP_PREFIX=> /usr/local/src/web/apache2/mod_perl-1.99_16/../httpd-2.0.51 MP_COMPAT_1X=> 1 MP_DEBUG=> 1 MP_GENERATE_XS => 1 MP_INST_APACHE2 => 1 MP_LIBNAME => mod_perl MP_TRACE=> 1 MP_USE_DSO => 1 MP_USE_STATIC => 1 *** /usr/local/apache2/bin/httpd -V Server version: Apache/2.0.51 Server built: Sep 24 2004 01:39:37 Server's Module Magic Number: 20020903:9 Architecture: 32-bit Server compiled with -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="/var/run/apache2/logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="/var/run/apache2/logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" *** (apr|apu)-config linking info -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr -lapr-0 -lrt -lm -lcrypt -lnsl -lpthread -ldl *** /usr/bin/perl -V Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=linux, osvers=2.6.3-deb2-skas3, archname=i386-linux uname='linux mizar 2.6.3-deb2-skas3 #1 sun mar 14 14:46:35 pst 2004 i686 unknown ' config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc', ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.4 20011002 (Debian prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -ldb -ldl -lm -lc -lcrypt perllibs=-ldl -lm -lc -lcrypt libc=/lib/libc-2.2.5.so, so=so, useshrplib=true, libperl=libperl.so.5.6.1 Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Apr 4 2004 05:57:53 %ENV: PERL_LWP_USE_HTTP_10="1" @INC: /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl . *** Packages of interest status: Apache::Request: - CGI: 2.752 LWP: 5.64, 5.69 mod_perl : 1.29, 1.9916 3. This is the core dump trace: (if you get a core dump): pho
Re: brand new staticised mod_perl 1.99.16 / apache 2.0.51 segfaults.
Stas Bekman wrote: Matthew, please try the current cvs, Philippe has been working hard on improving the static build since _16 was released. http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution -8<-- Start Bug Report 8<-- 1. Problem Description: Thanks for the quick response, Stas - unfortunately with the latest mod_perl cvs, things still segfault immediately: 2. Used Components and their Configuration: *** mod_perl version 1.9917 *** using /usr/local/src/web/apache2/mod_perl-2.0-cvs/lib/Apache/BuildConfig.pm *** Makefile.PL options: MP_APR_LIB => aprext MP_AP_CONFIGURE => --enable-maintainer-mode --prefix=/usr/local/apache2 --localstatedir=/var/run/apache2 --with-mpm=prefork MP_AP_PREFIX=> /usr/local/src/web/apache2/mod_perl-2.0-cvs/../httpd-2.0.51 MP_COMPAT_1X=> 1 MP_DEBUG=> 1 MP_GENERATE_XS => 1 MP_INST_APACHE2 => 1 MP_LIBNAME => mod_perl MP_TRACE=> 1 MP_USE_DSO => 1 *** ../../httpd-2.0.51/.libs/httpd -V Server version: Apache/2.0.51 Server built: Sep 24 2004 02:24:28 Server's Module Magic Number: 20020903:9 Architecture: 32-bit Server compiled with -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="/var/run/apache2/logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="/var/run/apache2/logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" *** (apr|apu)-config linking info -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr/.libs -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr -lapr-0 -lrt -lm -lcrypt -lnsl -lpthread -ldl -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr-util/.libs -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr-util -laprutil-0 -lgdbm -ldb3 -lexpat *** /usr/bin/perl -V Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=linux, osvers=2.6.3-deb2-skas3, archname=i386-linux uname='linux mizar 2.6.3-deb2-skas3 #1 sun mar 14 14:46:35 pst 2004 i686 unknown ' config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc', ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.4 20011002 (Debian prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -ldb -ldl -lm -lc -lcrypt perllibs=-ldl -lm -lc -lcrypt libc=/lib/libc-2.2.5.so, so=so, useshrplib=true, libperl=libperl.so.5.6.1 Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Apr 4 2004 05:57:53 %ENV: PERL_LWP_USE_HTTP_10="1" @INC: /usr/local/lib/perl/5.6.1 /usr/local/share/perl/5.6.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.6.1 /usr/share/perl/5.6.1 /usr/local/lib/site_perl . *** Packages of interest stat
Re: brand new staticised mod_perl 1.99.16 / apache 2.0.51 segfaults.
Stas Bekman wrote: Matthew, please try the current cvs, Philippe has been working hard on improving the static build since _16 was released. http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution Okay, my previous build using latest mod_perl cvs was slightly screwy due to not cleaning the build tree sufficiently & not realising that you now specify MP_USE_STATIC=1 to build a statically linked httpd. Armed with this knowledge, i'm happy to say that it doesn't crash under debian unstable - but under stable, the same problem presents itself. :( (under debian unstable, I had to export -I/usr/lib/perl/5.8/CORE/ in CPPFLAGS for it to find the right perl headers when compiling) -8<-- Start Bug Report 8<-- 1. Problem Description: mod_perl 2.0 CVS head + apache 2.0.51 segfault at startup under debian stable. I also had to butcher ./src/modules/perl/modperl_exports.c to remove non-existent symbol references to get it to compile. 2. Used Components and their Configuration: *** mod_perl version 1.9917 *** using /usr/local/src/web/apache2/mod_perl-2.0-cvs/lib/Apache/BuildConfig.pm *** Makefile.PL options: MP_APR_LIB => aprext MP_AP_CONFIGURE => --enable-maintainer-mode --prefix=/usr/local/apache2 --localstatedir=/var/run/apache2 --with-mpm=prefork MP_AP_PREFIX=> /usr/local/src/web/apache2/mod_perl-2.0-cvs/../httpd-2.0.51 MP_COMPAT_1X=> 1 MP_DEBUG=> 1 MP_GENERATE_XS => 1 MP_INST_APACHE2 => 1 MP_LIBNAME => mod_perl MP_TRACE=> 1 MP_USE_STATIC => 1 *** /usr/local/src/web/apache2/mod_perl-2.0-cvs/../httpd-2.0.51/httpd -V Server version: Apache/2.0.51 Server built: Sep 24 2004 03:14:03 Server's Module Magic Number: 20020903:9 Architecture: 32-bit Server compiled with -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="/var/run/apache2/logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="/var/run/apache2/logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" *** (apr|apu)-config linking info -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr/.libs -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr -lapr-0 -lrt -lm -lcrypt -lnsl -lpthread -ldl -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr-util/.libs -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr-util -laprutil-0 -lgdbm -ldb3 -lexpat *** /usr/bin/perl -V Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=linux, osvers=2.6.3-deb2-skas3, archname=i386-linux uname='linux mizar 2.6.3-deb2-skas3 #1 sun mar 14 14:46:35 pst 2004 i686 unknown ' config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc', ccflags ='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.4 20011002 (Debian prerelease)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, usemymalloc=n, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lgdbm -ldb -ldl -lm -lc -lcrypt perllibs=-ldl -lm -lc -lcrypt libc=/lib/libc-2.2.5.so, so=so, useshrplib=t
Re: brand new staticised mod_perl 1.99.16 / apache 2.0.51 segfaults.
On Thu, 23 Sep 2004, Stas Bekman wrote: Matthew Hodgson wrote: Stas Bekman wrote: Matthew, please try the current cvs, Philippe has been working hard on improving the static build since _16 was released. http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution -8<-- Start Bug Report 8<-- 1. Problem Description: Thanks for the quick response, Stas - unfortunately with the latest mod_perl cvs, things still segfault immediately: I hope Philippe will have time to look at it tomorrow. I guess that the problem has to do with perl-5.6 that you use. We were testing only with 5.8 so far. I could be wrong. The dynamic build is not working for you either? The dynamic build runs, but a bunch of tests fail due to an undefined symbol of apr_bucket_setaside_notimpl with errors like: t/apr-ext/base64Can't load '/usr/local/src/web/apache2/mod_perl-2.0-cvs/blib/arch/Apache2/auto/APR/APR.so' for module APR: /usr/local/src/web/apache2/mod_perl-2.0-cvs/blib/arch/Apache2/auto/APR/APR.so: undefined symbol: apr_bucket_setaside_notimpl at /usr/lib/perl/5.6.1/DynaLoader.pm line 202. at /usr/local/src/web/apache2/mod_perl-2.0-cvs/blib/lib/Apache2/APR/Base64.pm line 23 Compilation failed in require at /usr/local/src/web/apache2/mod_perl-2.0-cvs/blib/lib/Apache2/APR/Base64.pm line 23. BEGIN failed--compilation aborted at /usr/local/src/web/apache2/mod_perl-2.0-cvs/blib/lib/Apache2/APR/Base64.pm line 23. Compilation failed in require at /usr/local/src/web/apache2/mod_perl-2.0-cvs/t/lib/TestAPRlib/base64.pm line 11. BEGIN failed--compilation aborted at /usr/local/src/web/apache2/mod_perl-2.0-cvs/t/lib/TestAPRlib/base64.pm line 11. Compilation failed in require at t/apr-ext/base64.t line 5. BEGIN failed--compilation aborted at t/apr-ext/base64.t line 5. t/apr-ext/base64dubious Test returned status 255 (wstat 65280, 0xff00) Failed TestStat Wstat Total Fail Failed List of Failed --- t/directive/env.t 81 12.50% 8 t/modperl/merge.t101 10.00% 2 t/modperl/merge2.t 101 10.00% 2 t/modperl/merge3.t 101 10.00% 2 t/protocol/echo_nonblock.t32 66.67% 2-3 t/protocol/pseudo_http.t 013136 46.15% 10-13 t/vhost/log.t 91 11.11% 9 21 tests skipped. Failed 20/218 test scripts, 90.83% okay. 11/3086 subtests failed, 99.64% okay. This is with CVS head of both mod_perl & httpd-2.0. I haven't had a chance to see whether the failure of these tests is a showstopper for simple mod_perl stuff. yours, Matthew. -- 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: brand new staticised mod_perl 1.99.16 / apache 2.0.51 segfaults.
On Fri, 24 Sep 2004, Matthew Hodgson wrote: Stas Bekman wrote: Matthew, please try the current cvs, Philippe has been working hard on improving the static build since _16 was released. http://perl.apache.org/download/source.html#Development_mod_perl_2_0_Source_Distribution Okay, my previous build using latest mod_perl cvs was slightly screwy due to not cleaning the build tree sufficiently & not realising that you now specify MP_USE_STATIC=1 to build a statically linked httpd. Armed with this knowledge, i'm happy to say that it doesn't crash under debian unstable - but under stable, the same problem presents itself. :( This is a complete stab in the dark, but I just noticed that my kernel made some unhappy threading complaints (for the first time ever) during trying to get Apache2/mod_perl2 running last night - I can't xref from the timestamps whether this was connected to the segfaulting mod_perl builds, or caused by non-mod_perl Apache2s or just the build process, but just in case it might be relavent: # cat /var/log/kern.log Sep 23 23:26:54 phoenix kernel: request_module[net-pf-10]: fork failed, errno 1 Sep 24 00:01:40 phoenix kernel: request_module[net-pf-10]: fork failed, errno 1 Sep 24 00:38:18 phoenix kernel: request_module[net-pf-10]: fork failed, errno 1 Sep 24 01:54:50 phoenix kernel: request_module[net-pf-10]: fork failed, errno 1 Sep 24 02:30:00 phoenix kernel: request_module[net-pf-10]: fork failed, errno 1 Sep 24 03:26:05 phoenix kernel: request_module[net-pf-10]: fork failed, errno 1 # uname -a Linux phoenix.arasphere.net 2.4.26-1mjh #2 Mon Apr 19 00:53:07 BST 2004 i686 unknown -8<-- Start Bug Report 8<-- 1. Problem Description: mod_perl 2.0 CVS head + apache 2.0.51 segfault at startup under debian stable. I also had to butcher ./src/modules/perl/modperl_exports.c to remove non-existent symbol references to get it to compile. 2. Used Components and their Configuration: *** mod_perl version 1.9917 *** using /usr/local/src/web/apache2/mod_perl-2.0-cvs/lib/Apache/BuildConfig.pm *** Makefile.PL options: MP_APR_LIB => aprext MP_AP_CONFIGURE => --enable-maintainer-mode --prefix=/usr/local/apache2 --localstatedir=/var/run/apache2 --with-mpm=prefork MP_AP_PREFIX=> /usr/local/src/web/apache2/mod_perl-2.0-cvs/../httpd-2.0.51 MP_COMPAT_1X=> 1 MP_DEBUG=> 1 MP_GENERATE_XS => 1 MP_INST_APACHE2 => 1 MP_LIBNAME => mod_perl MP_TRACE=> 1 MP_USE_STATIC => 1 *** /usr/local/src/web/apache2/mod_perl-2.0-cvs/../httpd-2.0.51/httpd -V Server version: Apache/2.0.51 Server built: Sep 24 2004 03:14:03 Server's Module Magic Number: 20020903:9 Architecture: 32-bit Server compiled with -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="/var/run/apache2/logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="/var/run/apache2/logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" *** (apr|apu)-config linking info -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr/.libs -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr -lapr-0 -lrt -lm -lcrypt -lnsl -lpthread -ldl -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr-util/.libs -L/usr/local/src/web/apache2/httpd-2.0.51/srclib/apr-util -laprutil-0 -lgdbm -ldb3 -lexpat *** /usr/bin/perl -V Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration: Platform: osname=linux, osvers=2.6.3-deb2-skas3, archname=i386-linux uname='linux mizar 2.6.3-deb2-skas3 #1 sun mar 14 14:46:35 pst 2004 i686 unknown ' config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dvendorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef Compiler: cc='cc', ccflags ='-DDEBIAN -fno-strict-aliasing -
mod_perl and 64-bit linux
I am considering upgrading to a 64-bit Opteron-based machine running RH linux. Using perl 5.8, apache 2, mod_perl. Has anyone run into any problems running their mod_perl applications on a 64-bit box with a 64-bit linux OS? Thanks in advance, Matthew -- 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
[mp2] segfault at startup under perl 5.8.1 and mod_perl-1.99_10-dev
When I start httpd without the LoadModule perl_module modules/mod_perl.so All is good. When I add the line above, and start "httpd -X" apache crashes before I even request the first page. Has anyone else seen this problem? #0 0x403124c3 in Perl_sv_upgrade () from /foo2/modules/mod_perl.so #1 0x40316362 in Perl_sv_setpvn () from /foo2/modules/mod_perl.so #2 0x402bd48a in perl_construct () from /foo2/modules/mod_perl.so #3 0x402a02fc in modperl_startup (s=0x8113598, p=0x80d2690) at mod_perl.c:230 #4 0x402a1401 in modperl_init (base_server=0x8113598, p=0x80d2690) at mod_perl.c:421 #5 0x402a15ce in modperl_hook_init (pconf=0x80d2690, plog=0x810e780, ptemp=0x8114798, s=0x8113598) at mod_perl.c:554 #6 0x8092721 in ap_run_open_logs () at eval.c:88 #7 0x8097244 in main () at eval.c:88 #8 0x401267f1 in __libc_start_main (main=0x8096b38 , argc=4, ubp_av=0xba94, init=0x8062e0c <_init>, fini=0x80ae910 <_fini>, rtld_fini=0x4000cdc4 <_dl_fini>, stack_end=0xba8c) at ../sysdeps/generic/libc-start.c:129 Test results Failed Test Stat Wstat Total Fail Failed List of Failed --- api/r_subclass.t 255 65280?? ?? % ?? apr-ext/uuid.t255 65280 36 200.00% 1-3 % make test TEST_VERBOSE=1 TEST_FILES="api/r_subclass.t apr-ext/uuid.t" # Running under perl version 5.008001 for linux # Current time local: Tue Sep 30 09:54:59 2003 # Current time GMT: Tue Sep 30 13:54:59 2003 # Using Test.pm version 1.24 Can't load '/foo2/mod_perl-1.99_10-dev/t/../blib/arch/auto/APR/APR.so' for module APR: /foo2/mod_perl-1.99_10-dev/t/../blib/arch/auto/APR/APR.so: undefined symbol: apr_hook_global_pool at /usr/lib/perl5/5.8.1/i686-linux/DynaLoader.pm line 229. at apr-ext/uuid.t line 25 Compilation failed in require at apr-ext/uuid.t line 25. dubious Test returned status 255 (wstat 65280, 0xff00) ERROR_LOG - [Tue Sep 30 09:54:56 2003] [info] mod_perl: using Perl HASH_SEED: 1512185368 END in modperl_extra.pl, pid=29653 [Tue Sep 30 09:54:57 2003] [info] mod_perl: using Perl HASH_SEED: 438443544 [Tue Sep 30 09:54:57 2003] [notice] Apache/2.0.47 (Unix) mod_perl/1.99_10-dev Perl/v5.8.1 configured -- resuming normal operations [Tue Sep 30 09:54:57 2003] [info] Server built: Sep 29 2003 16:47:33 [Tue Sep 30 09:54:57 2003] [debug] prefork.c(1037): AcceptMutex: sysvsem (default: sysvsem) [Tue Sep 30 09:54:59 2003] [error] server reached MaxClients setting, consider raising the MaxClients setting [Tue Sep 30 09:55:00 2003] [info] Child process pid=29657 is exiting [Tue Sep 30 09:55:00 2003] [info] Child process pid=29655 is exiting [Tue Sep 30 09:55:00 2003] [info] removed PID file /foo2/mod_perl-1.99_10-dev/t/logs/httpd.pid (pid=29654) [Tue Sep 30 09:55:00 2003] [notice] caught SIGTERM, shutting down END in modperl_extra.pl, pid=29654 % perl -V - Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration: Platform: osname=linux, osvers=2.4.7, archname=i686-linux uname='linux darwin.ottawa.loran.com 2.4.7 #1 fri aug 24 17:04:10 edt 2001 i686 unknown ' config_args='-ds -e -Dprefix=/usr' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O3', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.3 20010315 (release)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lbind -lnsl -lgdbm -ldl -lm -lcrypt -lutil -lc -lposix perllibs=-lbind -lnsl -ldl -lm -lcrypt -lutil -lc -lposix libc=/lib/libc-2.2.3.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.2.3' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under linux Compiled at Sep 26 2003 09:57:10 @INC: /usr/lib/perl5/5.8.1/i686-linux /usr/lib/perl5/5.8.1 /usr/lib/perl5/site_perl/5.8.1/i686-linux /usr/lib/perl5/site_perl/5.8.1 /usr/lib/perl5/site_perl . BTW, Perl builds with: All tests successful. u=4.76 s=0.9 cu=244.92 cs=21.82 scripts=764 tests=76509
Re: [mp2] segfault at startup under perl 5.8.1 and mod_perl-1.99_10-dev
here is a stack with perl debugging enabled. (gdb) bt #0 0x4034411f in S_new_xpv () at sv.c:756 #1 0x40344c35 in Perl_sv_upgrade (sv=0x404265e0, mt=4) at sv.c:1392 #2 0x4034b11c in Perl_sv_setpvn (sv=0x404265e0, ptr=0x403fb53c "", len=0) at sv.c:4108 #3 0x402cd0e4 in perl_construct (my_perl=0x8121d88) at perl.c:279 #4 0x402af0ec in modperl_startup (s=0x8113598, p=0x80d2690) at mod_perl.c:230 #5 0x402b01f1 in modperl_init (base_server=0x8113598, p=0x80d2690) at mod_perl.c:421 #6 0x402b03be in modperl_hook_init (pconf=0x80d2690, plog=0x810e780, ptemp=0x8114798, s=0x8113598) at mod_perl.c:554 #7 0x8092721 in ap_run_open_logs () at eval.c:88 #8 0x8097244 in main () at eval.c:88 #9 0x401267f1 in __libc_start_main (main=0x8096b38 , argc=2, ubp_av=0xbac4, init=0x8062e0c <_init>, fini=0x80ae910 <_fini>, rtld_fini=0x4000cdc4 <_dl_fini>, stack_end=0xbabc) at ../sysdeps/generic/libc-start.c:129 Matthew Darwin wrote: When I start httpd without the LoadModule perl_module modules/mod_perl.so All is good. When I add the line above, and start "httpd -X" apache crashes before I even request the first page. Has anyone else seen this problem? #0 0x403124c3 in Perl_sv_upgrade () from /foo2/modules/mod_perl.so #1 0x40316362 in Perl_sv_setpvn () from /foo2/modules/mod_perl.so #2 0x402bd48a in perl_construct () from /foo2/modules/mod_perl.so #3 0x402a02fc in modperl_startup (s=0x8113598, p=0x80d2690) at mod_perl.c:230 #4 0x402a1401 in modperl_init (base_server=0x8113598, p=0x80d2690) at mod_perl.c:421 #5 0x402a15ce in modperl_hook_init (pconf=0x80d2690, plog=0x810e780, ptemp=0x8114798, s=0x8113598) at mod_perl.c:554 #6 0x8092721 in ap_run_open_logs () at eval.c:88 #7 0x8097244 in main () at eval.c:88 #8 0x401267f1 in __libc_start_main (main=0x8096b38 , argc=4, ubp_av=0xba94, init=0x8062e0c <_init>, fini=0x80ae910 <_fini>, rtld_fini=0x4000cdc4 <_dl_fini>, stack_end=0xba8c) at ../sysdeps/generic/libc-start.c:129 Test results Failed Test Stat Wstat Total Fail Failed List of Failed --- api/r_subclass.t 255 65280?? ?? % ?? apr-ext/uuid.t255 65280 36 200.00% 1-3 % make test TEST_VERBOSE=1 TEST_FILES="api/r_subclass.t apr-ext/uuid.t" # Running under perl version 5.008001 for linux # Current time local: Tue Sep 30 09:54:59 2003 # Current time GMT: Tue Sep 30 13:54:59 2003 # Using Test.pm version 1.24 Can't load '/foo2/mod_perl-1.99_10-dev/t/../blib/arch/auto/APR/APR.so' for module APR: /foo2/mod_perl-1.99_10-dev/t/../blib/arch/auto/APR/APR.so: undefined symbol: apr_hook_global_pool at /usr/lib/perl5/5.8.1/i686-linux/DynaLoader.pm line 229. at apr-ext/uuid.t line 25 Compilation failed in require at apr-ext/uuid.t line 25. dubious Test returned status 255 (wstat 65280, 0xff00) ERROR_LOG - [Tue Sep 30 09:54:56 2003] [info] mod_perl: using Perl HASH_SEED: 1512185368 END in modperl_extra.pl, pid=29653 [Tue Sep 30 09:54:57 2003] [info] mod_perl: using Perl HASH_SEED: 438443544 [Tue Sep 30 09:54:57 2003] [notice] Apache/2.0.47 (Unix) mod_perl/1.99_10-dev Perl/v5.8.1 configured -- resuming normal operations [Tue Sep 30 09:54:57 2003] [info] Server built: Sep 29 2003 16:47:33 [Tue Sep 30 09:54:57 2003] [debug] prefork.c(1037): AcceptMutex: sysvsem (default: sysvsem) [Tue Sep 30 09:54:59 2003] [error] server reached MaxClients setting, consider raising the MaxClients setting [Tue Sep 30 09:55:00 2003] [info] Child process pid=29657 is exiting [Tue Sep 30 09:55:00 2003] [info] Child process pid=29655 is exiting [Tue Sep 30 09:55:00 2003] [info] removed PID file /foo2/mod_perl-1.99_10-dev/t/logs/httpd.pid (pid=29654) [Tue Sep 30 09:55:00 2003] [notice] caught SIGTERM, shutting down END in modperl_extra.pl, pid=29654 % perl -V - Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration: Platform: osname=linux, osvers=2.4.7, archname=i686-linux uname='linux darwin.ottawa.loran.com 2.4.7 #1 fri aug 24 17:04:10 edt 2001 i686 unknown ' config_args='-ds -e -Dprefix=/usr' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O3', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.3 20010315 (release)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlo
Re: [mp2] segfault at startup under perl 5.8.1 and mod_perl-1.99_10-dev
I now have it working on RedHat 9 with the same configuration options. So unless someone wants to debug this for interest sake, I'm not bothered by it any more. Let me know if you want me to post more info. Thanks, Stas Bekman wrote: Matthew, please submit a complete bug report as explained at: http://perl.apache.org/bugs/ __ 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 -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca
Strange (13)permission denied in 1.28
Hi all, I just upgraded from Apache 1.27/mod_perl 1.27 to Apache 1.28/mod_perl 1.28 and am noticing some weird behaviour on Apache::Registry scripts - executing a Registry script ( /webroot/www.domain.com/perl/test.pl ) by calling a URL such as: http://www.domain.com/perl/test.pl/movies/image/1234 pops up a message in the error log that: [Wed Oct 1 14:13:01 2003] [error] [client 217.207.98.119] (13)Permission denied: access to /movies/images/1234 failed because search permissions are missing on a component of the path The script itself seems to run correctly - test.pl is a completely simple dummy which just prints headers and exits. Now, /webroot/www.domain.com/movies/ exists, deliberately has permissions 0700 and is owned by root - but why is Apache or Apache::Registry trying to stat that path at all - and how do I stop it or stop the error messages? any help would be gratefully received; Matthew. Matthew Hodgson [EMAIL PROTECTED] Tel: +44 7968 722968 Arathorn: Co-Sysadmin, TheOneRing.net®
[mp2] Declining from response handler bypasses other handlers
I'm using a PerlResponseHandler to control access to selected directories of a site, and I've encountered a similar problem to that described in http://marc.theaimsgroup.com/?l=apache-modperl&m=106141216914801&w=2 where returning a 'declined' status is skipping other handlers and going straight to Apache's default handler. My code is: package MyApache::Permissions; use strict; use warnings; use Apache::RequestRec (); use Apache::Const -compile => qw(OK DECLINED); my %protected_dirs = ( 'foo' => 1, 'bar/baz' => 1, ); sub handler { my $r = shift; my $requested_dir = $r->filename; $requested_dir =~ s|^/home/www/html/my_site/(.*)/[^\/]*$|$1|; return Apache::DECLINED unless exists $protected_dirs{$requested_dir}; $r->content_type('text/plain'); print "mod_perl has taken over the $requested_dir directory...\n"; return Apache::OK; } 1; and this is active over the whole site, using these directives in httpd.conf: SetHandler perl-script PerlResponseHandler MyApache::Permissions Blocking the named directories works fine, but for the unblocked directories (the ones for which I return Apache::DECLINED) the existing (non-Perl) response handlers aren't taking effect, so my ColdFusion scripts are being sent through unparsed, and directory indexes no longer work (/something/index.html works, /something/ returns a 404). I suspect the problem is on the Apache side; the SetHandler is overriding all other handlers. Is there any way around this? I'm using Apache/2.0.47 and mod_perl/1.99_10, on Linux. - Matthew
Re: [mp2] Declining from response handler bypasses other handlers
On 2 Oct 2003 at 9:15, Geoffrey Young wrote: > if you want to dynamically decide who should serve the page - mod_perl if > some directory is found, mod_php otherwise, then you can use your own > PerlTypeHandler or PerlFixupHandler to set $r->handler for the request based > on your own criteria. Many thanks - a PerlFixupHandler has done the job nicely. The fixup handler makes the decision, turning on a custom PerlResponseHandler if so. For the record, here's the code I arrived at: sub handler { my $r = shift; my $requested_dir = $r->filename; $requested_dir =~ s|^/home/www/html/my_site/(.*)/[^\/]*$|$1|; return Apache::OK unless exists $permission{$requested_dir}; $r->handler('perl-script'); $r->set_handlers(PerlResponseHandler => \&restricted_response); return Apache::OK; } sub restricted_response { my $r = shift; my $requested_dir = $r->filename; $requested_dir =~ s|^/home/www/html/my_site/(.*)/[^\/]*$|$1|; $r->content_type('text/plain'); print "mod_perl has taken over the $requested_dir directory...\n"; return Apache::OK; } 1; invoked with PerlFixupHandler MyApache::Permissions - Matthew
Re: anchor tag
On 30 Oct 2003 at 1:24, martin moss wrote: > Heyho, > > If I have a url of http://some.domain.com/test/index.html#test > > When I do a $r->uri I ge the url path /test/index.html > and $r->path_info is blank. > > How do I get the #test anchor bit on the end of the url? You can't, unfortunately - the anchor part of the URL is never seen by the server at all. - Matthew
[mp2] OutputFilter with UTF-8 characters
I'm just wondering if anyone has any input on this issue. I'm implementing an output filter, like so: SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOutputFilterHandler Apache::Kinnetics::Output and I get the following error on some web pages that have UTF-8 data: [Wed Nov 05 17:30:00 2003] [error] [client 127.0.0.1] panic: sv_pos_b2u: bad byte offset at /kinnetics/component/perllib/site_perl/Apache/Kinnetics/Output.pm line 221. Line 221 is the start of this regex: s{ <\?nm( # opening angle bracket (?: # Non-backreffing grouping paren [^>'"] * # 0 or more things that are neither > nor ' nor " | #or else ".*?"# a section between double quotes (stingy match) | #or else '.*?'# a section between single quotes (stingy match) ) + # repetire ad libitum # hm are null tags <> legal? XXX )\?> # closing angle bracket }{kinnetics_handler($r, $1)}geisx; # mutate configuration info httpd -V Server version: Apache/2.0.48 Server built: Oct 27 2003 15:07:21 Server's Module Magic Number: 20020903:4 Architecture: 32-bit Server compiled with -D APACHE_MPM_DIR="server/mpm/prefork" -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled) -D APR_USE_PROC_PTHREAD_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D HTTPD_ROOT="/kinnetics/component/httpd" -D SUEXEC_BIN="/kinnetics/component/httpd/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" perl -V Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration: Platform: osname=linux, osvers=2.4.21-2.elsmp, archname=i386-linux-thread-multi uname='linux bugs.devel.redhat.com 2.4.21-2.elsmp #1 smp wed sep 17 15:00:55 edt 2003 i686 i686 i386 gnulinux ' config_args='-des -Doptimize=-O2 -g -pipe -march=i386 -mcpu=i686 -Dversion=5.8.1 -Dmyhostname=localhost [EMAIL PROTECTED] -Dcc=gcc -Dcf_by=Red Hat, Inc. -Dinstallprefix=/usr -Dprefix=/usr -Darchname=i386-linux -Dvendorprefix=/usr -Dsiteprefix=/usr -Dotherlibdirs=/usr/lib/perl5/5.8.1 -Duseshrplib -Dusethreads -Duseithreads -Duselargefiles -Dd_dosuid -Dd_semctl_semun -Di_db -Ui_ndbm -Di_gdbm -Di_shadow -Di_syslog -Dman3ext=3pm -Duseperlio -Dinstallusrbinperl -Ubincompat5005 -Uversiononly -Dinc_version_list=5.8.0/i386-linux-thread-multi 5.8.0 -Dpager=/usr/bin/less -isr' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2 -g -pipe -march=i386 -mcpu=i686', cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='3.3.1 20030915 (Red Hat Linux 3.3.1-5)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc libc=/lib/libc-2.3.2.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.3.2' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.8.1/i386-linux-thread-multi/CORE' cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: DEBUGGING MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT Built under linux Compiled at Sep 25 2003 15:25:29 %ENV: PERL5LIB="/usr/local/perl5/site_perl:etc..." @INC: /usr/local/perl5/site_perl etc.. . -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: [mp2] OutputFilter with UTF-8 characters
Stas Bekman wrote: I'd suggest to take whatever data you s/// and try it outside mod_perl first. May be your filter or some previous filter has truncated the UTF-8 char in the middle? You should be aware that other filters are not aware of the encoding, and they just give you the amount of data your filter asks for. So it's quite possible that you can't process the data as-is when you get it, because you may get only a half of the char. So you either need to recognize that and buffer it up for the next filter invocation or you should ask for more data to get the other half. It'd be definitely a good test to add to our test suite, once this is resolved on your side. Thanks Stas, Here is my handler(). How can you tell if you're in the middle of a UTF-8 character or not? Also, does perl know at this point that it is a UTF-8 string? or do I need to tell it again (ie as the string goes through apache it looses it UTF-8 bit?) sub handler { my $f = shift; my $r = $f->r; unless ($f->ctx) { $f->r->headers_out->unset('Content-Length'); set_globals($f->r); $f->ctx(1); $leftover = ''; } while ($f->read(my $buffer, BUFF_LEN)) { $f->print (do_it ($r, $leftover . $buffer)); } return Apache::OK; } sub do_it { my $r = shift; local ($_); $_ = shift; # [insert the regex you've seen] # bucket brigades may split an NMML expression over # multiple buckets hold on to any trailing NMML and # prepended it to the start next time if (/<\?nm/) { ($_, $leftover) = split (/<\?nm/, $_, 2); $leftover = " return $_; } __ 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 -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: mod_perl and mysql
I've been using mysql+mod_perl for years. You should check that you aren't connecting to the database in the apache startup phase and then using the same connection in a handler. Ged Haywood wrote: Hi there, On Tue, 11 Nov 2003, Global Junk wrote: I'm running Linux Apache/1.3.26 (Unix) mod_perl/1.26 PHP/4.2.3 and MySQL. I'm trying to write a simple web (perl) application that accesses a mysql database. I'm using DBI(). When I access the site under normal Perl it works. When I access the site under Mod_Perl I get: child pid 20524 exit signal Segmentation fault (11), possible coredump in /usr/local/apache You should upgrade both Apache and mod_perl to the latest releases, 1.3.29 and 1.29, although that's unlikely to fix your segfault by itself. You don't say how mod_perl was compiled (nor who compiled it) I'd recommend static if possible. You must use the same compiler (I always use gcc, try something like 3.2.x or 3.3.2 if you can but 2.95 is OK for example) to compile Perl and mod_perl. You don't say which versions of Perl, MySQL and DBI you're using, but check they're up to date too. If you're using Perl 5.005_03 that's fine, but don't use 5.6.0. If you're using 5.8.0 right now you're probably best advised to wait for Perl 5.8.2, as 5.8.1 has a few issues - but it does work OK. You don't say what the machine is, I guess it's a PC. No problems there unless you're short on memory, how much have you got? Are you using PHP? Does anyone have any ideas or links to help with Mod_Perl and MySQL running together? It's a very common and very reliable setup, I and many others have been using it for years, with many different versions of Apache, mod_perl and mysql on many different machines. There are no real problems them working together. 73, Ged. -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: [mp2] OutputFilter with UTF-8 characters
After extensive playing around with this (inside mod_perl and out), I have come up with two observations: 1) doing regexes on UTF-8 characters split across buckets in an output filter seems to be not a problem. All my regexes are against ASCII characters. 2) mod_perl seems to get confused when I use $_ in a content handler and a filter for the same request. For example, one of the content handlers does this: sub handler { while () { print; } ... } The output received is mangled when received by the filter itself. Sometimes some of the debugging output i send to STDERR even ends up in the input to my filter. My filter: sub handler { my ($f) = shift; my $r = $f->r; unless ($f->ctx) { $f->r->headers_out->unset('Content-Length'); set_globals($f->r); $f->ctx(1); $leftover = ''; } while ($f->read(my $buffer, BUFF_LEN)) { print STDERR "DEBUG BUFFER: [$buffer]\n\n"; $f->print (do_it ($r, $leftover . $buffer)); } return Apache::OK; } The regex I was using in the quoted e-mail below also used $_. Now that I've changed it and my while() loop in the content handler to a "my" variable things look much better. Stas Bekman wrote: Matthew Darwin wrote: Stas Bekman wrote: I'd suggest to take whatever data you s/// and try it outside mod_perl first. May be your filter or some previous filter has truncated the UTF-8 char in the middle? You should be aware that other filters are not aware of the encoding, and they just give you the amount of data your filter asks for. So it's quite possible that you can't process the data as-is when you get it, because you may get only a half of the char. So you either need to recognize that and buffer it up for the next filter invocation or you should ask for more data to get the other half. It'd be definitely a good test to add to our test suite, once this is resolved on your side. Thanks Stas, Before trying to solve things, please do what I've asked you for. Take the contents $leftover . $buffer it's complaining about and run do_it outside mod_perl filter (in a simple script). Just to confirm that my suggestion was correct. If it's the in-the-middle problem, you will see the same problem outside of mod_perl. Here is my handler(). How can you tell if you're in the middle of a UTF-8 character or not? Also, does perl know at this point that it is a UTF-8 string? or do I need to tell it again (ie as the string goes through apache it looses it UTF-8 bit?) Apache IO never sets or unsets any bits, it just passes through raw data to and from the client. Once Perl passes its data to Apache, all magic bits are lost (because they live in the SV (scalar) datastructure and not string itself). I'd suggest that you read perlunicode.pod and perluniintro.pod manpages and you tell us the answers to these questions. I've a very limited experience in this area and will need to read those docs myself to give you correct answers. But the problem could be totally different as suggested above. It's quite possible that all you need to do to fix the problem is to run: utf8::decode($_); sub do_it { my $r = shift; local $_ = shift; utf8::decode($_); ... __ 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 -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
Re: About Authenticate Dialog
In mod_perl 2: sub handler { my ($r) = shift; my ($res, $password) = ($r->get_basic_auth_pw); return $res if $res;#decline if not Basic my $username = $r->user; if ($username eq '') { $r->note_basic_auth_failure; $r->log_error ("no account given for uri=<" . $r->uri . ">"); return Apache::AUTH_REQUIRED; } # etc... return Apache::OK; } Kai wrote: Hi List, I am going to write a HTTP authentication by using mod_perl.And I wrote some code like the following: --- #!/usr/bin/perl -w use CGI; my $p=new CGI; print $p->header(-status=>401, -www_authenticate='Basic realm="test area"', -type=>'text/html'); --- Now,if I open this script,the brower will pop a authenticate box. I want to know,how can I get the id and password that the client inputed in that authenticate box . Would someone give any advice ? Thanx. Regards, Kai -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca -- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html
if-modified-since
Does anyone have any code snippets demonstrating the generation of an if-modified-since header from within a mod_perl script? Using apache2/mod_perl on redhat. We process templates using text::template, and generate our own content-type header, but from what I can tell, apache doesn't prepend the if-modified-since header to our pages. I'd like to help google and others to NOT hammer our servers ;) Thanks in advance, Matthew -- 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
compile problems
Apologies if I'm posting in the wrong place, but here goes: AMD Opteron, Suse 9.1, perl 5.8.6, Apache 2.0.52, mod_perl 1.99_17 Apache compiles fine. When compiling mod_perl, I execute "/usr/local/bin/perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs" and then make, and get: /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/../../../../x86_64-suse- linux/bin/ld: /usr/local/lib/perl5/5.8.6/x86_64-linux/auto/DynaLoader/ DynaLoader.a(DynaLoader.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC /usr/local/lib/perl5/5.8.6/x86_64-linux/auto/DynaLoader/DynaLoader.a: could not read symbols: Bad value collect2: ld returned 1 exit status A perl -V reveals: Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=linux, osvers=2.6.5-7.95-smp, archname=x86_64-linux uname='linux local03 2.6.5-7.95-smp #1 smp thu jul 1 15:23:45 utc 2004 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Dcccdlflags=-fPIC' hint=previous, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -I/usr/local/include -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccversion='', gccversion='3.3.3 (SuSE Linux)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.3.3' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_64_BIT_INT USE_64_BIT_ALL USE_LARGE_FILES Built under linux Compiled at Dec 16 2004 22:56:14 @INC: /usr/local/lib/perl5/5.8.6/x86_64-linux /usr/local/lib/perl5/5.8.6 /usr/local/lib/perl5/site_perl/5.8.6/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.6 /usr/local/lib/perl5/site_perl . Any thoughts? Thanks, Matthew -- 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: compile problems
Found a solution worth writing about. I went through the perl configuration interactively, specifying the following non-defaults: - compile perl as shared - use gcc, not cc, as the compiler - provide -fPIC to the compiler After this, everything worked like a charm! On Dec 17, 2004, at 2:05 AM, Matthew Berk wrote: Apologies if I'm posting in the wrong place, but here goes: AMD Opteron, Suse 9.1, perl 5.8.6, Apache 2.0.52, mod_perl 1.99_17 Apache compiles fine. When compiling mod_perl, I execute "/usr/local/bin/perl Makefile.PL MP_APXS=/usr/local/apache2/bin/apxs" and then make, and get: /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.3/../../../../x86_64-suse- linux/bin/ld: /usr/local/lib/perl5/5.8.6/x86_64-linux/auto/DynaLoader/ DynaLoader.a(DynaLoader.o): relocation R_X86_64_32 can not be used when making a shared object; recompile with -fPIC /usr/local/lib/perl5/5.8.6/x86_64-linux/auto/DynaLoader/DynaLoader.a: could not read symbols: Bad value collect2: ld returned 1 exit status A perl -V reveals: Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=linux, osvers=2.6.5-7.95-smp, archname=x86_64-linux uname='linux local03 2.6.5-7.95-smp #1 smp thu jul 1 15:23:45 utc 2004 x86_64 x86_64 x86_64 gnulinux ' config_args='-des -Dcccdlflags=-fPIC' hint=previous, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=define uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -I/usr/local/include -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' ccversion='', gccversion='3.3.3 (SuSE Linux)', gccosandvers='' intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -ldl -lm -lcrypt -lutil -lc perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc libc=, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.3.3' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_64_BIT_INT USE_64_BIT_ALL USE_LARGE_FILES Built under linux Compiled at Dec 16 2004 22:56:14 @INC: /usr/local/lib/perl5/5.8.6/x86_64-linux /usr/local/lib/perl5/5.8.6 /usr/local/lib/perl5/site_perl/5.8.6/x86_64-linux /usr/local/lib/perl5/site_perl/5.8.6 /usr/local/lib/perl5/site_perl . Any thoughts? Thanks, Matthew -- 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
contention for require()'d code library
Apologies in advance for the conceptual nature of this inquiry. I have two chunks of code that are being run as separate scripts under Registry. Both are using require() (I know, I know) to pull in a library of subroutines. The behavior I'm seeing, which is quite odd, is that without warning, one or the other of the scripts will all of the sudden return a server error, complaining about an "undefined subroutine" reference in the script. It's as if the functions in the library of a sudden disappear, and I wonder whether or not there's some strange contention between the two scripts for use of the library which they both include(). Besides not keeping strict, which I'm doing intentionally to support a bit of older code, am I violating a fundamental rule of mod_perl around namespace contention? Thanks in advance, Matthew
preferred LB methods
Folks, Am fresh off the chapters dealing with load balancing in Practical mod_perl, but wanted to ask if folks have had any success using LVS in lieu of the recommended Squid or if anyone's had any success with other OS projects like Balance. Personally, I'm used to shelling out for Cisco, F5 or another device, but this time around want to stick to the open source world. We're graduating from round-robin DNS to something more intelligent, but I want to be sensitive to the the fact that we're using MP exclusively. Thanks in advance for any feedback. Matthew
Re: contention for require()'d code library
I have come up with a bit of a hackish, near term solution. Wanted to share it with the group. - check to see if a subroutine in the library is defined() - if not, delete() the library name from %INC - require() the library This corrects the behavior we were seeing quite well, without much overhead for recompilation. Again, the case was: - registry script foo.pl - registry script bar.pl - library lib.pl - both scripts require() the library Best, Matthew On Feb 8, 2005, at 11:52 AM, Joe Schaefer wrote: Matthew Berk <[EMAIL PROTECTED]> writes: Apologies in advance for the conceptual nature of this inquiry. I have two chunks of code that are being run as separate scripts under Registry. Both are using require() (I know, I know) to pull in a library of subroutines. If you're abusing require() as a means of adding external subroutines directly into your script, then that's not going to work with Registry. One thing that works, I think, would be to use a package declaration at the start of the library, and change the script to call those subroutines by their package-qualified names: old lib: sub foo {} ... new lib: package Foo; sub foo{} ... old script: require $mylib; foo(4); ... new script: require $mylib; Foo::foo(4); ... This may not be the best solution, but I'm sure this issue is well documented somewhere on the perl.apache.org site. -- Joe Schaefer
Sharing variables across Apache threads with threads::shared
Hi, I'm having trouble with the basics of sharing a variable across multiple Apache threads using threads::shared . The only code snippet I've been able to find on this subject is from the list archives from last month: http://gossamer-threads.com/lists/modperl/modperl/77651#77651 I'm stuck at a much earlier stage than that, so I'm a bit lost in the details of that code - I think I'm working along the same sort of lines though. My code is as follows: --- package MyApache::MagicNumber; use strict; use warnings; use threads; use threads::shared; use Apache::Const -compile => qw(OK); use Apache::RequestRec (); use Apache::RequestIO (); my $magic_number : shared; sub post_config { $magic_number = int(rand(100)); my $now = gmtime(time); `echo "$now: MagicNumber initialised to $magic_number by PID $$" >> /tmp/magicnumber.log`; return Apache::OK; } sub handler { my $r = shift; $r->content_type('text/html'); if ($r->args =~ /increment/) { $magic_number++; my $now = gmtime(time); `echo "$now: magic_number incremented to $magic_number by PID $$" >> /tmp/magicnumber.log`; } print "the magic number is$magic_number"; return Apache::OK; } 1; --- This is set up in httpd.conf like this: PerlModule MyApache::MagicNumber PerlPostConfigHandler MyApache::MagicNumber::post_config SetHandler perl-script PerlResponseHandler MyApache::MagicNumber Repeatedly calling http://localhost/magicnumber?increment indicates that each thread is keeping its own copy of $magic_number - they are all starting from the same initial value set in post_config, at least. magicnumber.log contains the following: Tue Feb 22 14:06:14 2005: MagicNumber initialised to 63 by PID 17452 Tue Feb 22 14:06:15 2005: MagicNumber initialised to 2 by PID 17454 Tue Feb 22 14:06:20 2005: magic_number incremented to 3 by PID 17459 Tue Feb 22 14:06:21 2005: magic_number incremented to 4 by PID 17459 Tue Feb 22 14:06:22 2005: magic_number incremented to 5 by PID 17459 Tue Feb 22 14:06:23 2005: magic_number incremented to 6 by PID 17459 Tue Feb 22 14:06:24 2005: magic_number incremented to 7 by PID 17459 Tue Feb 22 14:06:38 2005: magic_number incremented to 3 by PID 17462 Tue Feb 22 14:06:38 2005: magic_number incremented to 4 by PID 17462 Tue Feb 22 14:06:39 2005: magic_number incremented to 5 by PID 17462 Tue Feb 22 14:06:41 2005: magic_number incremented to 6 by PID 17462 Tue Feb 22 14:06:45 2005: magic_number incremented to 3 by PID 17458 Tue Feb 22 14:06:46 2005: magic_number incremented to 4 by PID 17458 Tue Feb 22 14:06:50 2005: magic_number incremented to 7 by PID 17462 I've checked that threads::shared is working correctly outside of mod_perl (via the examples on http://www.perl.com/pub/a/2002/06/11/threads.html ) - any suggestions where I'm going wrong? I'm running mod_perl 1.99_12 on Apache 2.0.47 with Perl 5.8.0. Thanks, - Matthew
Re: Sharing variables across Apache threads with threads::shared
On 22 Feb 2005, at 15:22, Richard F. Rebel wrote: Hello Matt, Some obvious things... Are you running a threaded apache mpm such as worker? If not, no threads, only processes, thus no sharing. You'd have to use another sharing mechanism in this case such as sysv ipc shared memory, or mmaps. When you use the worker mpm, the maximum number of apache threads per process is 64. If you have 75 client connections, then you end up with at least two processes depending on how you set up apache. Each process will have it's own copy of the variable that will be incremented independently of the others. Shared variables will not be shared across PID's ($$). Hi Richard, That would indeed seem to be the problem - I'm running the prefork MPM. It sounds like I'm better off going back to the drawing board rather than switching to worker and getting bitten by the 64 thread limit later! Many thanks for the advice, - Matthew
[mp2] DirectoryIndex issues
I've been trying to track down why the DirectoryIndex under Apache2+MP2 isn't working with the following configuration. From Google and listserv searching, the only suggestion I found was to add a "RedirectMatch permanent (.*)/$ $1/index.html" to my config, but this doesn't seem like a good solution and others have reported experiencing the same problem. Is there a simple fix to this httpd.conf file; is this a known issue with Apache2+MP2? Any help would be appreciated. Thanks, Matthew - This URL works correctly: http://ip.ip.ip.ip/testnomp2/ This URL returns a 403 Forbidden: http://ip.ip.ip.ip/testmp2/ and reports "Directory index forbidden by rule: /home/www/testmp2/" in the error_log. This URL works correctly: http://ip.ip.ip.ip/testmp2/index.pl - Apache/2.0.53 (Unix) mod_ssl/2.0.53 OpenSSL/0.9.7e mod_perl/1.999.21 Perl/v5.8.6 configured - % cat /usr/local/etc/apache2/httpd.conf Userapache Group apache Listen ip.ip.ip.ip:80 # -- modules -- LoadModule apreq_module modules/mod_apreq.so # -- logging -- LogFormat "%h %l %u %t \"%r\" %>s %b" common ErrorLog /var/apache2/logs/error_log # -- basic restrictions -- Options None +FollowSymLinks AllowOverride None Order Deny,Allow Deny from all # -- virtual host -- CustomLog /var/apache2/logs/access_log common Alias /testnomp2 /home/www/testnomp2 DirectoryIndex index.html Allow from all Alias /testmp2 /home/www/testmp2 DirectoryIndex index.pl Options +ExecCGI SetHandler perl-script PerlHandler ModPerl::Registry Order Allow,Deny Allow from all - % pwd /home/www % ls -laR drwxr-xr-x 2 apache apache 512 Feb 24 10:33 testmp2 drwxr-xr-x 2 apache apache 512 Feb 24 10:33 testnomp2 ./testmp2: -rwxr-xr-x 1 apache apache 118 Feb 24 10:33 index.pl ./testnomp2: -rw-r--r-- 1 apache apache 30 Feb 24 10:33 index.html
[JOB] Senior MP, Perl Engineer(s)
[JOB] About the position(s): Open List, Inc. is seeking talented, take-charge, SENIOR Perl engineers to improve and extend our core vertical search platform. We're looking to build a small, dedicated team of world-class Perl and MP developers here in New York, N.Y. Applicants will have a proven track record designing, building and maintaining complex Web applications. Experience with high-volume Web crawling and/or search technology a huge plus. About the company: Open List, Inc. (formerly Local-I) develops and operates vertical search applications. Our aim is to help our users make faster and better decisions. The company has thus far applied its proprietary classification, content aggregation and search technology to restaurants and hotels nationwide. Development of additional verticals and geographies is currently in progress. Web site: http://www.openlist.com/ Job details:http://www.openlist.com/about/jobs.htm Inquiries: [EMAIL PROTECTED] (please send resume, cover letter) Thanks, Matthew Berk Co-Founder and C.T.O. Open List, Inc. It takes strong Perl to discover great pearls.
Re: [ap2/mp2] post-processing handler output with another module (php)
On 13 Mar 2005, at 14:20, John ORourke wrote: Hi, I'm sure I should know this, but I'm trying to post-process the output of my handler with PHP. I'm still a bit green on Apache inner workings and just can't make it happen. Just to be clear - your mod_perl handler is outputting PHP source which you then hope to feed to PHP? If so, I don't think it's possible directly - PHP can only be invoked as a response handler which reads the script from the filesystem, and there can only be one response handler in use. That said, I have two suggestions of varying hairiness: 1. Make your mod_perl handler a PerlFixupHandler (or any appropriate earlier stage) which writes the PHP script to a file, and then set up PHP as the response handler: $r->handler('php-script'); You may need to tinker with other response fields to avoid PHP getting confused, such as re-statting the file: my $finfo = APR::Finfo::stat($filename, APR::FINFO_NORM, $r->pool()); $r->finfo($finfo); 2. Forget about using the PHP Apache module; pipe the output of your PerlResponseHandler through the command-line PHP interpreter instead. - Matthew
Apache2::Status, B::TerseSize
Trying to track down a bit o' memory bloat using the Symbol Table dump in /perl-status and B::TerseSize. Running into some problemsError: [Wed May 11 15:38:54 2005] [error] [client ::1] Use of uninitialized value in length at /Library/Perl/5.8.6/darwin-thread-multi-2level/Apache2/Status.pm line 562.\n, referer: http://localhost/perl-status/?symdump(The page actually starts with "Memory Usage for package main\n\nTotals: 67848 bytes | 0 OPs", but then there's a server error.)Perl Version: 5.8.6Apache: 2.0.54OS: SuSeMP: 2.0.0-RC6Setup in httpd.conf is:PerlModule Apache2::compat SetHandler perl-script PerlHandler Apache2::StatusPerlSetVar StatusOptionsAll OnPerlSetVar StatusTerse OnPerlSetVar StatusTerseSize OnPerlSetVar StatusTerseSizeMainSummary OnPerlModule B::TerseSizeAny thoughts?Thanks,Matthew
[JOB] Senior Perl Engineer, MP focus
About the position: Open List, Inc. (http://www.openlist.com/) is seeking a talented, SENIOR Perl engineer to improve and extend its core vertical search platform. Extensive MP experience required. Applicants must have a proven track record designing, building and maintaining complex, high-volume interactive Web applications. Experience with search technologies a great plus. This is a full- time, on-site role, located in New York, N.Y. About the company: Open List, Inc. develops and operates vertical search applications. Our aim is to help consumers make faster and better decisions. The company has thus far applied its proprietary classification, content aggregation and search technology to restaurants and hotels nationwide. Development of additional verticals and geographies is currently in progress. Please send all inquiries (resume AND cover letter) to [EMAIL PROTECTED] All applicants will be asked to submit code samples. Thanks, Matthew Berk CTO, Open List, Inc. It takes strong Perl to discover great pearls.
apache crash with MP2 Win32
Hi all, Would anyone know where to start looking about how to track down the source of this following line in error.log: Apache2::Filter: (620018) APR does not understand this error code at -e line 0 When this is printed, Apache stops handling requests and restarts. We can reproduce this by clicking on a few web pages in quick succession. Operating environment for Apache is: mod_perl 2.0.0 apache 2.0.54 mod_ssl Windows XP Professional The module that uses Apache2::Filter looks like this: package BlaBlaBla; use strict; use Apache2::Filter (); use Apache2::RequestRec (); use Apache2::Connection (); use APR::Table (); my $utf8_leftover; my $leftover; [...] sub handler { my ($f) = shift; $r = $f->r; unless ($f->ctx) { if ($r->content_type =~ m#^text/#) { $f->r->headers_out->unset('Content-Length'); } set_globals (); $f->ctx(1); $leftover = ''; $utf8_leftover = ''; binmode (STDOUT, ":utf8"); binmode (STDERR, ":utf8"); } if ($r->content_type =~ m#^text/#) { while ($f->read(my $buffer, BUFF_LEN)) { utf8::encode ($leftover); $f->print (do_it ($leftover . $utf8_leftover . $buffer)); } } else { while ($f->read(my $buffer, BUFF_LEN)) { $f->print ($buffer); } } return Apache2::Const::OK; } [...]
Re: apache crash with MP2 Win32 HTTPS
Not sure if this helps. It looks like maybe an SSL problem, not related to mod_perl? [Wed Sep 21 12:10:20 2005] [info] Initial (No.1) HTTPS request received for child 246 (server myserver:443) [Wed Sep 21 12:10:23 2005] [info] Connection to child 249 established (server myserver:443, client 172.22.10.19) [Wed Sep 21 12:10:24 2005] [info] Subsequent (No.2) HTTPS request received for child 246 (server myserver:443) [Wed Sep 21 12:10:24 2005] [info] (OS 10053)An established connection was aborted by the software in your host machine. : core_output_filter: writing data to the network [Wed Sep 21 12:10:24 2005] [info] (620019)APR does not understand this error code: SSL output filter write failed. Apache2::Filter: (620019) APR does not understand this error code at -e line 0 [Wed Sep 21 12:10:25 2005] [notice] Parent: child process exited with status 9 -- Restarting. Matthew Darwin wrote: Hi all, Would anyone know where to start looking about how to track down the source of this following line in error.log: Apache2::Filter: (620018) APR does not understand this error code at -e line 0 When this is printed, Apache stops handling requests and restarts. We can reproduce this by clicking on a few web pages in quick succession. Operating environment for Apache is: mod_perl 2.0.0 apache 2.0.54 mod_ssl Windows XP Professional The module that uses Apache2::Filter looks like this: package BlaBlaBla; use strict; use Apache2::Filter (); use Apache2::RequestRec (); use Apache2::Connection (); use APR::Table (); my $utf8_leftover; my $leftover; [...] sub handler { my ($f) = shift; $r = $f->r; unless ($f->ctx) { if ($r->content_type =~ m#^text/#) { $f->r->headers_out->unset('Content-Length'); } set_globals (); $f->ctx(1); $leftover = ''; $utf8_leftover = ''; binmode (STDOUT, ":utf8"); binmode (STDERR, ":utf8"); } if ($r->content_type =~ m#^text/#) { while ($f->read(my $buffer, BUFF_LEN)) { utf8::encode ($leftover); $f->print (do_it ($leftover . $utf8_leftover . $buffer)); } } else { while ($f->read(my $buffer, BUFF_LEN)) { $f->print ($buffer); } } return Apache2::Const::OK; } [...] -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca
Re: apache crash with MP2 Win32 HTTPS
This issue is also being tracked at http://issues.apache.org/bugzilla/show_bug.cgi?id=36751 Any input is more than welcome... Quote: <<< If a mod_perl "croak" means the whole process is terminated, then that much really is a mod_perl bug. Output filters may very well fail and return errors under abnormal circumstances such as aborted connections. >>> Matthew Darwin wrote: Not sure if this helps. It looks like maybe an SSL problem, not related to mod_perl? [Wed Sep 21 12:10:20 2005] [info] Initial (No.1) HTTPS request received for child 246 (server myserver:443) [Wed Sep 21 12:10:23 2005] [info] Connection to child 249 established (server myserver:443, client 172.22.10.19) [Wed Sep 21 12:10:24 2005] [info] Subsequent (No.2) HTTPS request received for child 246 (server myserver:443) [Wed Sep 21 12:10:24 2005] [info] (OS 10053)An established connection was aborted by the software in your host machine. : core_output_filter: writing data to the network [Wed Sep 21 12:10:24 2005] [info] (620019)APR does not understand this error code: SSL output filter write failed. Apache2::Filter: (620019) APR does not understand this error code at -e line 0 [Wed Sep 21 12:10:25 2005] [notice] Parent: child process exited with status 9 -- Restarting. Matthew Darwin wrote: Hi all, Would anyone know where to start looking about how to track down the source of this following line in error.log: Apache2::Filter: (620018) APR does not understand this error code at -e line 0 When this is printed, Apache stops handling requests and restarts. We can reproduce this by clicking on a few web pages in quick succession. Operating environment for Apache is: mod_perl 2.0.0 apache 2.0.54 mod_ssl Windows XP Professional The module that uses Apache2::Filter looks like this: package BlaBlaBla; use strict; use Apache2::Filter (); use Apache2::RequestRec (); use Apache2::Connection (); use APR::Table (); my $utf8_leftover; my $leftover; [...] sub handler { my ($f) = shift; $r = $f->r; unless ($f->ctx) { if ($r->content_type =~ m#^text/#) { $f->r->headers_out->unset('Content-Length'); } set_globals (); $f->ctx(1); $leftover = ''; $utf8_leftover = ''; binmode (STDOUT, ":utf8"); binmode (STDERR, ":utf8"); } if ($r->content_type =~ m#^text/#) { while ($f->read(my $buffer, BUFF_LEN)) { utf8::encode ($leftover); $f->print (do_it ($leftover . $utf8_leftover . $buffer)); } } else { while ($f->read(my $buffer, BUFF_LEN)) { $f->print ($buffer); } } return Apache2::Const::OK; } [...] -- Matthew Darwin [EMAIL PROTECTED] http://www.mdarwin.ca
RE: index.pl not default, even when specified
Dickon Wrote: >2. No matter what I try to do, index.pl does not show up as the default >page. Instead, Apache gives me a directory listing. I've tried >searching various lists and forums but I cannot find a straightforward >solution. Hello Dickon, I was intrigued by your dilemma and I tried unsuccessfully to get my own apache program to serve something other than index.html as the default page. So I gave up on forcing another file to show and used a module to serve a page instead. Using this SetHandler modperl PerlResponseHandler Apache2::Hello Options +ExecCGI FollowSymLinks PerlOptions +ParseHeaders AllowOverride None ##and my Hello.pm file is as follows: package Apache2::Hello; use strict; use Apache2::RequestRec (); # for $r->content_type use Apache2::RequestIO (); # for $r->puts use Apache2::Const -compile => ':common'; sub handler { my $r = shift; my $time = scalar localtime(); my $package = __PACKAGE__; $r->content_type('text/html'); $r->puts(<<"END"); Hello World. END return Apache2::Const::OK; } 1; ### HTH ,Matthew
mp1, mason, apache::dbi multiple database issue
Hello, I wasn't sure if I should post here, on the Mason list, or elsewhere; hopefully someone here can help. I'm using mp1, Mason, Apache::DBI, and MySQL InnoDB tables. When adding a second database connection to our code, a very simple getUserIdFromSession subroutine returns inconsistent values. Removing the second connection fixes the problem. I added warnings inside the getUserIdFromSession subroutine (below) to track down where the problem might be, but: - the DBH connection is always to the proper database (I printed out a SHOW TABLES statement). - it always receives the cookie value correctly - it always falls into the else { return $userId; } portion - sometimes it returns the value, other times it returns undef While connected outside of apache to the database server, I can see the record in the tUserSession table using the same SQL statement the code is using. If I simply comment out the connection to $dbhEmail in the autohandler, the problem goes away, and the subroutine always returns the proper value. I've been scratching my head for awhile on this one, but can't see why adding another global and a different connection would cause this. Thanks in advance, Matthew httpd.conf -- PerlAddVar MasonAllowGlobals $dbh PerlAddVar MasonAllowGlobals $dbhEmail startup.pl -- use Apache::DBI(); use DBI(); use DBD::mysql (); autohandler --- <%once> use Apache::Cookie qw(); use Foo::Auth; use Foo::Constants; use Foo::User; <%init> $dbh = DBI->connect("DBI:mysql:$CONSTANTS{DB_BASE}content:$CONSTANTS{DB_HOST}", $CONSTANTS{DB_USER}, $CONSTANTS{DB_PASS}, {AutoCommit => 0, RaiseError => 1, PrintError => 0} ) or die "ERROR: Cannot connect to database"; $dbhEmail = DBI->connect("DBI:mysql:$CONSTANTS{DB_BASE}email:$CONSTANTS{DB_HOST}", $CONSTANTS{DB_USER}, $CONSTANTS{DB_PASS}, {AutoCommit => 0, RaiseError => 1, PrintError => 0} ) or die "ERROR: Cannot connect to database"; <%perl> my(%cookies)= Apache::Cookie->fetch(); # -- login session -- my($userId) = getUserIdFromSession($dbh, \%cookies); my($userObject) = undef; if (defined($userId)) { $userObject = Foo::User->new()->init($dbh); unless ($userObject->load([EMAIL PROTECTED], $userId)) { $userObject = undef; } } <% $m->call_next( userObject => $userObject ) %> Foo/Auth.pm --- package Foo::Auth; @ISA = qw( Exporter ); use strict; use warnings; our($SESSION_COOKIE_NAME) = 'user_session'; our($SESSION_KEY_LENGTH) = 50; our(@EXPORT) = qw( $SESSION_KEY_LENGTH getUserIdFromSession doLogin ); sub getUserIdFromSession { my($dbh, $rCookies) = @_; croak 'API' unless defined($dbh); croak 'API' unless defined($rCookies) && ref($rCookies) eq 'HASH'; my($cookie) = $rCookies->{$SESSION_COOKIE_NAME}; return undef unless defined($cookie); my($sessionKey) = $cookie->value(); return undef unless defined($sessionKey) && length($sessionKey) == $SESSION_KEY_LENGTH; my($userId) = eval { return $dbh->selectrow_array(q{ SELECT userId FROM tUserSession WHERE sessionKey=? AND expiresOn>NOW() }, undef, $sessionKey); }; if ($@) { return undef; } else { return $userId; } } sub doLogin { my($dbh, $rErrors, $username, $ip) = @_; my($sessionKey) = _createSessionKey(); eval { my($userId) = $dbh->selectrow_array(q{ SELECT userId FROM tUser WHERE userName=? }, undef, $username); $dbh->do(q{ INSERT INTO tUserSession (sessionKey, userId, createdOn, createdIp, expiresOn) VALUES (?,?,NOW(),?,ADDDATE(NOW(), INTERVAL 1 DAY)) }, undef, $sessionKey, $userId, $ip); $dbh->commit(); }; if ($@) { push @$rErrors, $@; eval { $dbh->rollback() }; push @$rErrors, $@ if $@; return undef; } else { return $sessionKey; } } 1;
use of STDERR in forked children
Hi, I originally posted this to the embperl listserv, but I haven't gotten any responses. So maybe somebody here can help me. I hope! I'm working on a mechanism to fork a a long running child process. I've followed the standard mod_perl forking wisdom in http://modperlbook.org/html/ch10_02.html. My issue is that warn() doesn't work in the child process, though printing directly to STDERR does. Also, I want STDERR to go to the apache log like it normally would, but I don't know how to determine what the path to the log is. I can't hard code it since it changes depending on the environment (dev vs. qa vs. prod). I haven't tried this using Apache::Registry (since we don't run it) but I thought it might be and Embperl thing since I couldn't find anything on the mod_perl lists... I'm using Apache 1.3 and Embperl 1.36 Your help is greatly appreciated. Here's the code: [# SNIP #] [! use POSIX 'setsid'; use Apache; !] [- my $childPid = undef; $SIG{CHLD} = 'IGNORE'; if ($childPid = fork) { $output = "Parent $$ has finished, kid's PID: $childPid\n"; } else { warn "starting child $$\n"; $req_rec->cleanup_for_exec( ); # untie the socket chdir '/' or die "Can't chdir to /: $!"; open STDIN, '/dev/null' or die "Can't read /dev/null: $!"; open STDOUT, '>/dev/null' or die "Can't write to /dev/null: $!"; open STDERR, '>>/tmp/log' or die "Can't write to /tmp/log: $!"; setsidor die "Can't start a new session: $!"; my $oldfh = select STDERR; local $| = 1; select $oldfh; # ends up in /tmp/log print STDERR "Where do the children [$$] play?\n"; # ends up nowhere warn "Where do the children [$$] play?\n"; # do something time-consuming for (1..20) { sleep 1; warn "$_\n"; } warn "completed $$\n"; CORE::exit(0); # terminate the process } -] [- $dbgLogLink = 0; -] [+ $output +] [# ENDSNIP #] __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
dhandler not performing as expected
Mason Gurus: I have the following dhandler issue with mason/mod_perl/apache v1.3: On disk, I have the following files... /home/me/inherit/one/index.html /home/me/inherit/one/test/dhandler /home/me/inherit/one/test/override <-- this is a file not a dir When I access "http://localhost/me/inherit/test/override/foo";, why do I see the contents of the "override" file? I would expect that the dhandler *should* be serving this! Then, if I call $m->decline() in the override file, why is $m->dhandler_arg() = 'override'? I would expect that it should be 'override/foo'! Thanks in advance, Matthew - httpd.conf... Alias /me/inherit /home/me/inherit/one DirectoryIndex index.html SetHandler perl-script PerlHandler HTML::Mason::ApacheHandler PerlAddVar MasonCompRoot "one => /home/me/inherit/one" PerlSetVar MasonDataDir /home/me/inherit/masondata Allow from all
Re: dhandler not performing as expected
My apologies, wrong list... Matthew Lineen wrote: Mason Gurus: I have the following dhandler issue with mason/mod_perl/apache v1.3:
migrating to 2.0 and getting tons of warnings
I can't seem to disable warnings on our production environment. 'use warnings' is not included in any of the config/startup/scripts or custom modules. Its possible I guess that its being used by a CPAN module. We had a system on Debian 3.1 (apache/mod_perl 1.x)and I have been doing work to migrate the app to Debian 5.0 (apache/mod_perl 2). I don't mine the extra log data in development and intend to fix these issues but I can't have these '-e: Use of uninitialized value' cramming up my production log files. I've tried everything I can think of, anyone have any ideas?
Re: migrating to 2.0 and getting tons of warnings
On Thu, 2009-02-26 at 15:49 -0500, Adam Prime wrote: > André Warnier wrote: > > Matthew Lenz wrote: > >> I can't seem to disable warnings on our production environment. 'use > >> warnings' is not included in any of the config/startup/scripts or custom > >> modules. Its possible I guess that its being used by a CPAN module. > >> > >> We had a system on Debian 3.1 (apache/mod_perl 1.x)and I have been doing > >> work to migrate the app to Debian 5.0 (apache/mod_perl 2). > >> > >> I don't mine the extra log data in development and intend to fix these > >> issues but I can't have these '-e: Use of uninitialized value' cramming > >> up my production log files. > >> > >> I've tried everything I can think of, anyone have any ideas? > >> > > > > If you are talking about cgi-bin scripts, then they probably all start > > with a line like > > #!/usr/bin/perl -w > > > > Removing the -w would do it. > > But the warnings themselves mean something that you'd better not ignore. > > > > To remove the -w, you could even use a perl one-liner, such as > > > > perl -pi'.bak' -e 's/^#!\/usr\/bin\/perl -w/#!\/usr\/bin\/perl/' *.pl > > > > .. but try this first on a limited set somewhere !!! > > > > Another thing to check is if you've got > > PerlSwitches -w > > in your httpd.conf, that'll turn on warnings too. > > Adam I have no 'use warnings' anywhere in my code/config. I have no shebangs with -w/W anywhere. I did however, JUST figure it out: PerlSwitches -X That's the only thing that would work and honestly its highly undesirable. The crazy thing is that ModPerl::RegistryCooker seems to expend a lot of time making damn well sure that it respects the scripts warnings settings. Maybe the debian guys did something goofy with the modules. It wouldn't be the first time. That or maybe its just a bug in ModPerl. Even if some CPAN module out there has 'use warnings;' in it that shouldn't have any affect on any code outside of its own package should it?
Re: migrating to 2.0 and getting tons of warnings
On Thu, 2009-02-26 at 17:17 -0500, Perrin Harkins wrote: > On Thu, Feb 26, 2009 at 4:01 PM, Matthew Lenz wrote: > > Maybe the debian guys did something goofy with the modules. It wouldn't > > be the first time. That or maybe its just a bug in ModPerl. Even if > > some CPAN module out there has 'use warnings;' in it that shouldn't have > > any affect on any code outside of its own package should it? > > Something could be setting $^W. Grep your code for that. I only found a single reference to $^W and it was setting it to 0 for a small block of code. It didn't really even need to do so as no code was enabling them. This same code is going from Debian 3.1 (apache 1, mod_perl 1, perl 5.8) to Debian 5.0 (apache 2, mod_perl 2, perl 5.10) and now I'm getting the warnings. I looked through the packge diff: http://ftp.de.debian.org/debian/pool/main/liba/libapache2-mod-perl2/libapache2-mod-perl2_2.0.4-5.diff.gz and didn't spot any changes that would have this affect. > - Perrin
Re: migrating to 2.0 and getting tons of warnings
On Fri, 2009-02-27 at 11:29 -0500, Perrin Harkins wrote: > On Fri, Feb 27, 2009 at 7:58 AM, Matthew Lenz wrote: > > I looked through the packge diff: > > > > http://ftp.de.debian.org/debian/pool/main/liba/libapache2-mod-perl2/libapache2-mod-perl2_2.0.4-5.diff.gz > > > > and didn't spot any changes that would have this affect. > > What about other CPAN modules you're using. Do you use a framework > like Mason? No, this is just a legacy app that runs straight CGI's via ModPerl::RegistryPrefork > You probably have different versions on the newer > machine. Absolutely, I'm guessing nearly every CPAN module being used is updated. > - Perrin I thought that if a package does a 'use warnings;' that it only affects code being executed in that package? Maybe that is not the case under mod perl 2? mod perl 1 didn't exhibit that behavior.
get backtrace emailed when code dies running under ModPerl::RegistryPrefork?
As I've mentioned in previous posts, I'm migrating from an older environment to a new environment with mod_perl 2. With mod_perl 1.x we had VERY OLD customised version of CGI::Carp (with fatalsToBrowser) printing an error to the browser AND sending an email with backtrace and environment information when the code died with a runtime errors. According to the docs CGI::Carp doesn't function properly with fatalToBrowser under mod_perl 2. The confusing thing is that right below the fatalsToBrowser documentation it talks about set_die_handler. Its not exactly clear as to whether set_die_handler doesn't work under mod_perl 2 or not. Is anyone using CGI::Carp for backtrace reporting? Is there an alternative that someone knows about if CGI::Carp isn't an option?
Re: get backtrace emailed when code dies running under ModPerl::RegistryPrefork?
On Mon, 2009-03-02 at 10:20 -0500, Perrin Harkins wrote: > On Mon, Mar 2, 2009 at 9:54 AM, Matthew Lenz wrote: > > According to the docs CGI::Carp doesn't function properly with > > fatalToBrowser under mod_perl 2. > > I'm not sure if that's accurate or not, but setting a $SIG{__DIE__} > handler should work fine. Isn't that basically what fatalsToBrowser does? You'd think that the CGI/Carp developer(s) would have been able to get it working with mod_perl 2. I can try it though. Will sticking the $SIG{__DIE__} in the startup.pl script be sufficient? > BTW, I assume you mean stacktrace, not > backtrace, which is usually associated with core dumps. HAHA, yes. I was just getting ready to correct myself :) Thanks for beating me to it. > - Perrin
Re: Ways to scale a mod_perl site
While many great minds are here, I would like to focus on one point for a moment, which in my experience, has been the most critical: The database Before I were to ask any other of your questions (all of which were valid), I would ask myself: - What kind of database tables am I implementing? (innodb, berkley,etc) What effect do they have on the filesystejm, or the pagefile? - How have I defined connections, connection pooling, shared resources, partitions v logical drives, semaphores v shared memory handles to handles? - Have I analyzed which tables actually get used, and by which processes, and paid attention to which operations only require simple foreign to primary key relationships, and not complex JOINS? And secondarily: - Is it possible to set up simple READ-ONLY copies of frequently read but rarely changed data (such as login information) so that some work could be off-loaded in an intelligent manner without regards to load balancing? In short, the database's interaction with the main application is most commonly the issue, regardless of the underlying technologies. Start there, so says I. Matthew P gedanken -- Matthew Paluch 404.375.8898
simple modperl 1.0 code example for a non programmer.
Hello, Id like to say that Ive been browsing http://perl.apache.org/ and its snippets section for help however I quickly realised that many of the examples where written for modperl 2.0 which is why Id like to ask if anybody could help me with a simple code snippet .. iam sure for the gurus this wont take long. Id like to dive in learning perl myself but that will happen later. All I need is a .pm that is hooked up via the PerlPostReadRequestHandler in the httpd.conf (apache 1.3) so that it sets co0kie if the GET var ($var) is present. This off course will be evaluated for all the requests to my webserver , thats the idea. Also, mod_perl is compiled with EVERYTHING=1 . Thanks to whom had the time to help. --Matt
[mp2] Makefile.PL does not detect correct MPM
'ellow, I have been trying to compile mod_perl1.99_13 but have found what I believe to be a bug in the Makefile.PL. I am using Debian woody with the Apache2 from backports.org. I am using the prefork (Apache1-style) MPM because I read in the mod_perl2 documentation that if you have Perl 5.6.1 this is the only MPM that can be used. I tried to compile mod_perl2 but despite my having removed the worker MPM package and installed the prefork one in its place, it still thinks I am using worker and therefore refuses to compile. To me this looks like a bug in the Makefile.PL. Here is the output I get: oblique:/usr/src/mod_perl2/mod_perl-1.99_13# perl Makefile.PL MP_APXS=/usr/bin/apxs2 Reading Makefile.PL args from @ARGV MP_APXS = /usr/bin/apxs2 Configuring Apache/2.0.48 mod_perl/1.99_13 Perl/v5.6.1 [ error] Using Perl 5.6.1 w/o ithreads and 'worker' mpm httpd. [ error] Failed requirements: [ error] - Perl 5.8 or higher - Perl built with ithreads (build perl with -Dusethreads) But this dpkg listing shows clearly that I have the prefork MPM package installed: un apache2 (no description available) ii apache2-common 2.0.48-6.backpor Next generation, scalable, extendable web server un apache2-dev (no description available) un apache2-doc (no description available) un apache2-modules (no description available) un apache2-mpm-perc(no description available) ii apache2-mpm-pref 2.0.48-6.backpor Traditional model for Apache2 un apache2-mpm-thre(no description available) pn apache2-mpm-work(no description available) ii apache2-prefork- 2.0.48-6.backpor Development headers for apache2 pn apache2-threaded(no description available) (I have no apache[1] packages installed.) Any help/info would be greatly appreciated -- I am at a loss as to what I am doing wrong here... bye just now, -- Matthew T. Atkinson <[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: [mp2] Makefile.PL does not detect correct MPM
'ellow, Thanks for your e-mail. I think that it might be something wrong with the packages I am using... On Mon, 2004-03-15 at 20:33, Stas Bekman wrote: > please show us the output of: > > /usr/bin/apxs2 -q MPM_NAME It returns ``worker''. But I definitely have the prefork and prefork development packages installed (not the worker ones). Does this mean it is a packaging bug? bye just now, -- Matthew T. Atkinson <[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
Running a mod_perl script at the domain root
I've spent at least a couple of hours trying to figure this out and reading manuals, to no avail, hence asking here. I hope it's not too obvious :-). I'm running a mod_perl (2.0.2) script from the root of my domain. My Apache (2.2.3) configuration is as follows. . . . PerlOptions +Parent PerlSwitches -T -I/var/www/testsite SetHandler perl-script PerlResponseHandler TestSite My script takes the whole URI and uses that as part of the input to tell it which part of the site the user wants to visit (such as / for the home page or /account to manage their contact details). The problem is that, because the script overrides the whole domain, a request for /logo.png or the CSS file will not work properly. I have tried using mod_rewrite to combat this, to no avail. I think the problem is that when I was using mod_python on a different site (a MoinMoin wiki as it happens), the handling of the request is different; it'd be more like the following: # map /wiki static files to Moin htdocs RewriteRule ^/wiki/(.*)$ /var/www/agdev-wiki/htdocs/$1 [last] # map everything else to server script RewriteRule ^(.*)$ /var/www/agdev-wiki/moinmodpy.py$1 In this case, I can successfully use mod_rewrite because I can send the request to a certain script. I can't see how to send the request to a certain location, as would appear to be required by the mod_perl setup. Could someone direct me to instructions or an example Apache config where they're running a mod_perl script at the domain root? Thanks very much for your time, best regards, P.S. My site is now running much faster under mod_perl (albeit without CSS or a logo at the moment :-)) -- mod_perl really does seem to rock maximally and I'm looking forward to getting it all working smoothly. -- Matthew Tylee Atkinson <[EMAIL PROTECTED]>
Re: Running a mod_perl script at the domain root
On Sun, 2008-02-10 at 16:47 -0500, Adam Prime wrote: > 1) You can modify TestSite to return DECLINED for any request that you > want to be handled by the filesystem rather than your handler. ie > . . . > > 2) If you've got all your CSS and images in directories dedicated to > those tasks, then you can add locations blocks that SetHandler > default-handler. ie: . . . Thanks very much for this! I went for the etc. approach in the end as it seemed more suitable for my situation. My site now seems a lot more alive :-). best regards, -- Matthew Tylee Atkinson <[EMAIL PROTECTED]>