Apache Configuration using PERL

N

nicklas.bornstein

Hi,

Im trying to use PERL, generating some of the Apache Configuration.
I have loaded the module mod_perl, and then do something like;

<Perl>
print 'ErrorDocument 404 http://www.google.dk';
</Perl>

in my httpd.conf - but the Apache Configuration don't evaluate on the
print, it just print out the line in the comand promt.

I have seach Google and found some example using somthing like;
use Apache::perlSections();

but I can't figure it out. If I use the PerlSections(), I get the
error;
"Can't locate Apache/PerlSections.pm in @INC ...".

How do I simply write some configuration line in my httpd.conf, using
Perl? Thanks!
 
J

J. Gleixner

Hi,

Im trying to use PERL, generating some of the Apache Configuration.
I have loaded the module mod_perl, and then do something like;

<Perl>
print 'ErrorDocument 404 http://www.google.dk';
</Perl>

in my httpd.conf - but the Apache Configuration don't evaluate on the
print, it just print out the line in the comand promt.

What do you expect it to do? Seems like it's working just fine.

How do I simply write some configuration line in my httpd.conf, using
Perl? Thanks!

http://perl.apache.org/docs/1.0/guide/config.html#Apache_Configuration_in_Perl
 
X

Xicheng Jia

Hi,

Im trying to use PERL, generating some of the Apache Configuration.
I have loaded the module mod_perl, and then do something like;

<Perl>
print 'ErrorDocument 404http://www.google.dk';
</Perl>

in my httpd.conf - but the Apache Configuration don't evaluate on the
print, it just print out the line in the comand promt.

I have seach Google and found some example using somthing like;
use Apache::perlSections();

but I can't figure it out. If I use the PerlSections(), I get the
error;
"Can't locate Apache/PerlSections.pm in @INC ...".

How do I simply write some configuration line in my httpd.conf, using
Perl? Thanks!

Check out this page:
=====

http://modperlbook.org/html/ch04_04.html

4.4.1. Constructing <Perl> Sections

=====
Instead of printing out Apache configration directives, you should do
something like:

<Perl>
@ErrorDocument = (
[ 404 => 'http://www.google.dk' ],
[ 500 => '/error.html' ],
);
</Perl>

(untested)
Regards,
Xicheng
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top