Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: mod_perl, and weird caching

by MidLifeXis (Monsignor)
on Feb 04, 2014 at 16:17 UTC ( [id://1073435]=note: print w/replies, xml ) Need Help??


in reply to mod_perl, and weird caching

The first vhost that loads a module wins. You have (at least) two approaches:

  • disambiguate by using different module names per vhost (ick)
  • use a single (common) module and configure the differences using a per-vhost configuration object.

--MidLifeXis

Replies are listed 'Best First'.
Re^2: mod_perl, and weird caching
by ultranerds (Hermit) on Feb 04, 2014 at 16:22 UTC
    Hi,

    Thanks for the reply!

    I had a feeling you were gonna say that :/ For the different module names... that doesn't sound like fun! Would it work by for example, changing:

    domain 1: lib/Foo/Bar.pm
    domain 2: lib/Foo2/Bar.pm

    use a single (common) module and configure the differences using a per-vhost configuration object.
    Could you explain this a bit more?

    Thanks!

    Andy

      Sure,

      You would make your module generic, so that it works with all of your vhosts. You would then configure the code based on some vhost specific setting. So for example, if you have a vhost-specific configuration file indicating the graphics file names for specific UI components, you could configure that file name in a per-vhost PerlVar.

      In your code, you could access this per-vhost setting. You could then use that setting to identify the location of the configuration file for that vhost, read the configuration, and respond.

      Basically, a persistent environment like mod_perl assumes that you are not changing the foundation that you are building the application upon. In order for that to hold true, you need to isolate the moving parts into something that you pass through the building infrastructure.

      --MidLifeXis

        Thanks for the detailed info. I'm not too sure how practice thats gonna be for the site (they are quite old, and pretty large). Maybe I'll have to get a dev install configured, and then play around with whats needed to change the module folders names around... i.e we have GT , Links and Plugin... so I could just rename them to GT2, Links2, Plugins2 - and update anywhere that calls them. Hardly ideal, but it would hopefully work.

        Someone also said this to me:

        You can't run multiple domains in the same mod_perl instance, major
        security risk. You need a separate physical apache process per domain.
        How would one go about setting separate Apache processes up? Sorry for my ignorance... I've been hosted on managed hosting for most of my time, so this is all quite new to me =)

        TIA
Re^2: mod_perl, and weird caching
by ultranerds (Hermit) on Mar 18, 2014 at 16:51 UTC
    For anyone interested, we managed to get it going by adding into pre_virtualhost_global.conf, for each VirtualHost
    PerlOptions +Parent PerlSwitches -Mlib=/home/domain.com/lib/perl
    According to the Cpanel tech guys, this means that it will run a perl instance separately per domain (which is what we need)

    We've got it setup on 2 sites now, and as far as I can see its working a charm (no inter-sharing files at all - which is great!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1073435]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-20 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found