Skip to main content

mod_perl... how to?

Comments

8 comments

  • Shavaun
    If I understand your inquiry correctly, you might find this section of the Apache's mod_perl documentation helpful:
    0
  • andynewby
    Hi, Thanks for the reply. That looks similar to how we had it before, in the VirtualHost. i.e: ServerName domain.org ServerAlias www.domain.org DocumentRoot /home/user/public_html ServerAdmin username @domain.org UseCanonicalName Off CustomLog /usr/local/apache/domlogs/domain.org combined CustomLog /usr/local/apache/domlogs/domain.org-bytes_log "%{%s}t %I .\n%{%s}t %O ." ErrorLog /home/user/error_log UserDir enabled user suPHP_UserGroup user user SuexecUserGroup user user RUidGid user user PerlRequire /home/user/startup.pl PerlModule Apache2::Reload PerlInitHandler Apache2::Reload PerlModule Apache2::RequestRec ScriptAlias /cgi-bin/ /home/user/public_html/cgi-bin/ SetHandler perl-script PerlResponseHandler ModPerl::Registry PerlOptions +ParseHeaders PerlOptions +SetupEnv Options +ExecCGI SetHandler cgi-script # To customize this VirtualHost use an include file at the following location # Include "/usr/local/apache/conf/userdata/std/2/user/domain.org/*.conf"
    This works with 1 site (if its the only one on the server using mod_perl). But as soon as you add it onto a 2nd domain, you find that the mod_perl instance "shares" the files from the first instance. For example, if we had 2 domains: foobar.com testing.com Both had a structure of /cgi-bin/Foo/Bar.pm, which gets called in test.cgi. If the first domain in the .conf file it comes across is foobar.com, then when test.cgi is called in EITHER of the domains - it would access Bar.pm from the foobar.cgi location (and totally ignore the testing.com version of it). From my discussions on perlmonks, this is due to how apache/mod_perl work. If you don't have separate Apache instances per copy of mod_perl running, then you end up with cross caching. They're suggestion was to make the server run the domains totally separate from each other..i.e one copy of Apache for each of the domains we want to run mod_perl under (we don't care about those who don't usa mod_perl :)) Any ideas? I've been doing a lot of reading up, but I'm still no closer to finding a solution :( TIA! Andy
    0
  • Shavaun
    The documentation on the Parent option (same link I sent earlier:
    0
  • andynewby
    Hi, Thanks for the reply. So from what I understand, you're suggesting adding this into the for the given domains: PerlOptions +Clone PerlInterpStart 2 PerlInterpMax 2 ...and this should run mod_perl seperate from the other domains? I'll get a test install setup - and see how it goes :) Thanks! Andy
    0
  • Shavaun
    Check the Parent section too - this bit might be applicable: [QUOTE] Parent Create a new parent Perl interpreter for the given VirtualHost and give it its own interpreter pool (implies the Clone option). A common problem with mod_perl 1.0 was the shared namespace between all code within the process. Consider two developers using the same server and each wants to run a different version of a module with the same name. This example will create two parent Perl interpreters, one for each , each with its own namespace and pointing to a different paths in @INC: META: is -Mlib portable? (problems with -Mlib on Darwin/5.6.0?) ServerName dev1 PerlOptions +Parent PerlSwitches -Mlib=/home/dev1/lib/perl ServerName dev2 PerlOptions +Parent PerlSwitches -Mlib=/home/dev2/lib/perl
    0
  • andynewby
    Thanks - will give that a go :)
    0
  • andynewby
    Thank you thank you thank you!!!!! Seems to be working a charm :)
    0
  • Shavaun
    Great! I'm very glad to hear that resolved the issue for you.
    0

Please sign in to leave a comment.