Question

I'm trying to use a Perl module from CPAN (AuthCookieDBI.pm to be specific) in a shared hosting environment.

I tried copying the .pm file to the directory I'm trying to use it with, and I have updated my .htaccess file as per the instructions on the AuthCookieDBI page, but my Apache log says:

Invalid command 'PerlModule', perhaps misspelled or defined by a module not 
included in the server configuration

This seems to be the line that causes the error:

PerlModule Apache2::AuthCookieDBI

According to the Apache:ASP FAQ this is caused because mod_perl is not installed; I'm on shared hosting (and so cannot do anything which requires root permissions), so is there nothing I can do about this?

Was it helpful?

Solution

Apache2::AuthCookieDBI requires mod_perl, so the module isn't any use to you without it.

OTHER TIPS

If you are on shared hosting, you are mostly likely not using mod_perl. Thus you can't use this module. In short, mod_perl is a way for programmers to interact with apache, potentially changing how things happen. Since you are sharing apache, it's not nice to make other people live with your changes.

If you want more control over your server, you need to get a dedicated web server. How you do that depends on what your provider offers.

Normally you use the cpan tool to download and install the module for you. It should be installed into a standard location, such as under /usr/local/lib (see perl -V to see where your @INC directory is set up to be). When it is properly installed, your perl scripts will be able to find the module just as if it was a standard part of perl, with no special modifications necessary in mod_perl or apache configs. (You can also install modules to your home directory without requiring root permission. Instructions for that are contained in the CPAN FAQ.)

See:

Also, the CPAN FAQ itself has lots of information.

Edit: after everything, it would appear that the true answer to your question is "You can't; you need to find a different module to do what you need, that doesn't require mod_perl".

Just put the unpacked the module to /path/lib/, below is the code you need in order to include this module.


#!/usr/bin/perl -w
use diagnostics;
use warnings;
use lib "$ENV{DOCUMENT_ROOT}/path/lib/";
unshift @INC , "$ENV{DOCUMENT_ROOT}/path/lib/";
use modulename;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top