Re: Ubuntu and mod_perl

André Warnier <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Fred Moyer wrote:
> On Tue, May 17, 2011 at 3:22 PM, Tom Kane <[email protected]> wrote:
>> Now, I have another issue: I have created a startup.pl file and placed it into the conf.d
>>  directory. However, when I restart apache2 I get an error message to the effect that the first
>> 'use' statement is a syntax error. I'm sure that my problem lies in my confusion as to (1) where
>> to point ServerRoot, and (2) where I'm supposed to put my perl scripts. These are all pretty
>> elementary, I suppose, but if anyone can shed any light, I will be very appreciative.
> 
> You should have a line in your httpd.conf that looks something like
> this.  If not, you will need to add it.
> 
> PerlPostConfigRequire /etc/apache2/conf.d/startup.pl
> 

I think that's a bit confused (and confusing).

Under Ubuntu/Debian, the directory /etc/apache2/conf.d is meant to contain bits of 
configuration which *apache* reads and interprets.  So whatever is in there, should not be 
perl scripts. It should be Apache directives, like inside httpd.conf.

(And that is also why you get (from Apache) that error about "use" being an invalid 
directive.  It is, for Apache, which does not understand perl.)

Place your perl startup.pl script somewhere else (for example directly in /etc/apache2), 
and then, in /etc/apache2/conf.d, create a file with the single text line :

PerlPostConfigRequire /etc/apache2/startup.pl

-----------------------

Now, let's mentally reboot and think about the future :

Later, you are (also) going to need a place to put your own mod_perl modules (the ones you 
are going to create).
So I suggest to create a directory for that, for example : /usr/local/lib/modperl, and 
make it readable and "executable" by the user under wich Apache runs (www-data ?).

Then, place your startup.pl script there.

Then, in /etc/apache2/conf.d, place a file (or modify the above file) with the line :

PerlPostConfigRequire /usr/local/lib/modperl/startup.pl

and in your startup.pl script, add a line

use lib "/usr/local/lib/modperl";

and restart Apache.

After that, you can place all your newly-developed perl modules inside the directory 
/usr/local/lib/modperl, and Apache/mod_perl will find them.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.