We help IT Professionals succeed at work.

apache config file and mod_perl

kesea asked
Medium Priority
Last Modified: 2010-03-05
Hi Experts,

Is there a way to have mod_perl installed on a server, and using it for perl scripts in your "Apache2/modperl" directory, but to have another directory, say just "Apache2/perl", that will run perl but not mod_perl?  Would this be done in the Apache config file, and if so, how?

Watch Question

You should set rules for your perl scripts to be run under mod_perl:

SetHandler          perl-script
PerlHandler         Apache::Registry  # (or another perl-handler)

For all other scripts that should be run through perl-interpretator, as single CGI files use:

SetHandler              cgi-script

You can use those directives in <Directory> blocks, or in <Location>, <Files> sections... You also can use inside of particular .htaccess file.

To map different handlers by-extension it's useful to write "AddHandler" directives:
AddHandler              cgi-script      .cgi
AddHandler              perl-script      .pl

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.