How to reload PERL module in all Apache children
Hello, I was wondering if there is a possibility to reload PERL module compiled into Apache with Apache::Registry (and I want to reload this module in all Apache children processes) by running reload-program once. For example Apache::Reload must be set as PerlInitHandler, so it's handler method is run every time request comes to Apache. What I'd like to do is to reload specified (or all) module by running the program ONCE. I tried using something like perl-status: Location /mod-perl-reload SetHandler perl-script PerlHandler Apache::MyReloadModule /Location where MyReloadModule's handler was deleting specified module from %INC and reloading it by require, but it didn't satisfy me becouse changes weren't seen in apache children processess (at least I think so), so I wrote something like this in MyReloadModule: sub handler { my $r = shift; Apache-request($r); . .sending HTML . foreach my $k (keys %INC) { $r-print($kBR); } $r-print(PID $$); $r-print(/BODY/HTML); } and I realised that changes I have made to %INC in one child process aren't seen in another one. So my problem can be set in another way: Do apache children communicate between themselves? Is it possible to write such a reloader script as I wanted to write? Maybe somebody already done this? Thanks in advance, Tomek Paterek
Re: Newbie Question
I am a relative newbie to mod_perl myself, but - I would think if you just want "a script to handle forms" that a vanilla CGI would be cake to set up and sufficient for your needs unless you get huge traffic. And I am led to think that if you just loaded ActivePerl then you are a long way from having mod_perl installed anyway. Have you recompiled Apache etc.? Or just use already built Win Apache / PERL / mod_perl distribution : ftp://theoryx5.uwinnipeg.ca/pub/other/ Regards, Waldek Grudzien _ http://www.uhc.lublin.pl/~waldekg/ University Health Care Lublin/Lubartow, Poland tel. +48 81 44 111 88 ICQ # 20441796 I know I have a lot of reading to do but I just thought I would add this to my first post. After loading Activeperl I changed the httpd.conf file by adding the following: Alias /perl/ c:/Program Files/Apache Group/Apache/cgi-bin Location /perl SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI /Location PerlModule Apache::Registry PerlModule CGI PerlSendHeader On It was after adding this that the service refused to restart. I will obviously have to read a whole lot more before this is going to work. The annoying thing is that I just want to run a script to handle forms seems like a hell of a lot of effort for such a simple request :)
Re: Apache locking up on WinNT
I added the warns to the scripts and it appears that access to the modules is serialised. Each call to the handler has to run to completion before any other handlers can execute. Yes, on NT all accesses to the perl part are serialized. This will not change before mod_perl 2.0 Oh my ... Indeed this happens. This is horrible ;o( and make mod_perl unusable with NT web site with many visitors ;o( How do you think - for intranet web application is it reasonable to run few Apaches (with mod_perl) on the same box ? [and assign users to the different apache]. How many Apache can I start ? BTW Does anyone know when mod_perl 2.0 is supposed to be released ? Best regards Waldek Grudzien _ http://www.uhc.lublin.pl/~waldekg/ University Health Care Lublin/Lubartow, Poland tel. +48 81 44 111 88 ICQ # 20441796
Re: Apache locking up on WinNT
Oh my ... Indeed this happens. This is horrible ;o( and make mod_perl unusable with NT web site with many visitors ;o( How do you think - for intranet web application is it reasonable to run few Apaches (with mod_perl) on the same box ? yes, but as far as I know that isn't possible as service. You must start them from the DOS prompt. (I didn't look at this since 1.3.6, so there may a change in 1.3.9) In 1.3.9 you can register as many services as you want... ;o) [and assign users to the different apache]. How many Apache can I start ? Only a matter of your memory... How much apaches with mod_perl won't hurt 128 MB NT box ? (for application with 91 scripts and modules with summary PERL code 376 KB) (or how many RAM should I add ?) You should also consider to move long running script to good old (external) cgi scripts I know - now... ;o) BTW Does anyone know when mod_perl 2.0 is supposed to be released ? It should be comming when Apache 2.0 is comming, don't know when this will be, but I don't expect it in the near future It is not good news ;-(. Many fellows can choose meantime PHP instead PERL solutions ;o( (moreover speed charts says PHPis a little bit faster than mod_perl http://www.chamas.com/hello_world.html) I like PERL so much so I wouldn't like to be forced (by boss ;o)) some day to start next web apps with PHP ;o( Best regards, Waldek Grudzien _ http://www.uhc.lublin.pl/~waldekg/ University Health Care Lublin/Lubartow, Poland tel. +48 81 44 111 88 ICQ # 20441796
Re: Apache locking up on WinNT
I am currently in the process of transferring a database driven site from IIS to Apache on NT using mod_perl. Apache seems to lock up after about 10-20 minutes and the only way to get things going again is to restart Apache (Apache is running from the console not as a service). Well - I am using NT distribution (APACHE 1.3.9 / mod_perl 1.21/ PERL 5.005_003) downloaded from : ftp://theoryx5.uwinnipeg.ca/pub/other/ and noticed no problem with it. Maybe the problem lays in your scripts (have you analised entry from apache log you have descibed) ? Regards, Waldek Grudzien _ http://www.uhc.lublin.pl/~waldekg/ University Health Care Lublin/Lubartow, Poland tel. +48 81 44 111 88 ICQ # 20441796
Re: NT Install ? wrt Perl versions
Try with ftp://theoryx5.uwinnipeg.ca/pub/other/ There is perl5.005_03, mod_perl-1.21, and Apache_1.3.9 built for Windows 95/98/NT made by Randy Kobes (easy to install and use... ;o) ) Regards, Waldek Grudzien _ http://www.uhc.lublin.pl/~waldekg/ University Health Care Lublin/Lubartow, Poland tel. +48 81 44 111 88 ICQ # 20441796 I'm about to install modperl on my NT Workstation for standalone testing. Its not clear to me whether the activestate version I have of perl (I have 5.005_03 binary build 520 Sept 28th/99) will work with the NT binary prepared under /authors/Jeffery_Baker or must I download the perl version of 5.005_02 found under the same folder /authors/Jeffery_Baker BTW the archive at http://forum.swarthmore.edu/epigone/modperl is down. David
mod_perl and module versions
Hello everyone, I have just started to play with mod_perl module I found a problem with my own modules (many versions of the module with the same name) I have found related topic dated on 28 Apr 97 (mod_perl and module versions), but unfortunatelly there was no solution... ;-( Lets say I have two directories : /cgi-bin/dir1 i /cgi-bin/dir2 and in every of them I have module conf.pm (configuration module). Of course the first using one of the module causes cache'ying it by mod_perl (using Apache::Registry or Apache::PerlRun). When I use 'use conf' from the other dir it sees the first included by perl_mod conf module (because it is present in global %INC) How can I force own namespace (including %INC) in every dir (application) ? BTW Merry X-mas and happy Y2K ;o) Best Regards, Waldek Grudzien _ http://www.uhc.lublin.pl/~waldekg/ University Health Care Lublin/Lubartow, Poland tel. +48 81 44 111 88 ICQ # 20441796