Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: mod_perl without separate config for static HTML?

by Mutant (Priest)
on Oct 26, 2004 at 13:28 UTC ( [id://402568]=note: print w/replies, xml ) Need Help??

in reply to mod_perl without separate config for static HTML?

If you can't configure Apache, your hands are kind of tied. The usual configuration of PHP is to only parse files with the extention of '.php'.

There's probably not such a clear standard when running under mod_perl, but it's quite simple to configure Apache to only run files that end in say '.cgi' under Apache::Registry:

<LocationMatch *.cgi> SetHandler perl-script PerlHandler Apache::Registry </LocationMatch>

(That's probably not the most efficient way to do it, but with Apache TMTOWTDI :) Another alternative would be to put all your scripts into one directory and set the location to that.)

If you're not really able to do much with the config (apart from the fact that you should be complaining to management that your work environment is preventing you from doing your job properly) the perfomance loss at having to run everything under Apache::Registry may be neglible, ie. it may not be enough by itself to swing the pendulum from Perl to PHP

Replies are listed 'Best First'.
Re^2: mod_perl without separate config for static HTML?
by gunzip (Pilgrim) on Oct 26, 2004 at 13:37 UTC

    Are you saying that using a mod_perl file extension, eg. .mpl, configured with Apache::Registry will result in static content being handled outside mod_perl? I can mess with httpd.conf to this extent but I'm not in a position to setup separate servers/ports/IPs to separate static HTML requests from mod_perl so your solution may save me from going down the mod_php route. What are the inefficiencies you alluded to?

    Are you also saying that configuring a distinct /perl directory for Apache::Registry scripts will leave the static pages to be handled as normal? That's what I normally do anyway?

      Here's a fairly typical Apache::Registry config:

      <Location /cgi/> SetHandler perl-script PerlHandler Apache::Registry Options ExecCGI </Location>

      Now, everything under the 'cgi' dir will be executed under Apache::Registry, and everything else (assuming you don't have other 'Location' etc. directives setup) will just be static.

      You can even use the 'Alias' directive to make the cgi dir outside of your public directories (usually a good idea).

      The ineffeciencies I metentioned just refered to the fact that I was using 'LocationMatch' which might not be necessary for what you're trying to do.

      As someone else mentioned, look at the apache docs and mod_perl docs. Apache/mod_perl config is an art from in itself, and it's definitely something you want to have a handle on if you're worried about performance

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-21 12:15 GMT
Find Nodes?
    Voting Booth?

    No recent polls found