The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mod_perl... how to?

Discussion in 'EasyApache' started by andynewby, Mar 14, 2014.

  1. andynewby

    andynewby Member

    Joined:
    Mar 14, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi all,

    I've been going around in circles with this for a while now. I can't seem to find a definitive answer (bear in mind, I dabble with server stuff... but I'm far from a pro =))

    I have 5 sites on my server. All of them ideally need to be under mod_perl. I've been told that they **shouldn't** share a mod_perl instance. Partly for security, but mainly due to the fact if you have Foo/Bar.pm in more than 1 site... it will ONLY load the instance from the first one - which is obliviously undesirable!). Previously, we only managed to get it on one site (the largest), due to the fact we added it into the pre_virtualhost_global.conf file (in the VirtualHost), and this meant that if we tried to use it on any others, it would have simply used the modules from the first site)

    Could anyone shed some light on how I would enable it? This is a new server - so I can play around with it a bit (was hard to do on the old server, as its currently live... but this gives me a chance to play around, without affecting anything!)

    TIA

    Andy
     
  2. Shavaun

    Shavaun Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    106
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
  3. andynewby

    andynewby Member

    Joined:
    Mar 14, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi,

    Thanks for the reply. That looks similar to how we had it before, in the VirtualHost. i.e:

    Code:
    <VirtualHost 207.58.xx.xxx:80>
    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
    <IfModule mod_suphp.c>
    suPHP_UserGroup user user
    </IfModule>
    <IfModule !mod_disable_suexec.c>
    <IfModule !mod_ruid2.c>
    SuexecUserGroup user user
    </IfModule>
    </IfModule>
    <IfModule mod_ruid2.c>
    RUidGid user user
    </IfModule>
    
    PerlRequire /home/user/startup.pl
    PerlModule Apache2::Reload
    PerlInitHandler Apache2::Reload
    PerlModule Apache2::RequestRec
    
    ScriptAlias /cgi-bin/ /home/user/public_html/cgi-bin/
    
    <Directory /home/user/public_html/cgi-bin>
    SetHandler perl-script
    PerlResponseHandler ModPerl::Registry
    PerlOptions +ParseHeaders
    PerlOptions +SetupEnv
    Options +ExecCGI
    </Directory>
    
    <Directory /home/user/public_html/cgi-bin/links/admin>
    SetHandler cgi-script
    </Directory>
    
    
    # To customize this VirtualHost use an include file at the following location
    # Include "/usr/local/apache/conf/userdata/std/2/user/domain.org/*.conf"
    
    </VirtualHost> 
    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 <VirtualHost> 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
     
  4. Shavaun

    Shavaun Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    106
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
  5. andynewby

    andynewby Member

    Joined:
    Mar 14, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Hi,

    Thanks for the reply. So from what I understand, you're suggesting adding this into the <VirtualHost> 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
     
  6. Shavaun

    Shavaun Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    106
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Check the Parent section too - this bit might be applicable:

     
  7. andynewby

    andynewby Member

    Joined:
    Mar 14, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thanks - will give that a go :)
     
  8. andynewby

    andynewby Member

    Joined:
    Mar 14, 2014
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Website Owner
    Thank you thank you thank you!!!!! Seems to be working a charm :)
     
  9. Shavaun

    Shavaun Well-Known Member

    Joined:
    Aug 15, 2013
    Messages:
    106
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    Root Administrator
    Great! I'm very glad to hear that resolved the issue for you.
     

Share This Page