Perl enable on Apache24

Good afternoon.
Need to enable support Perl on Apache24 with virtual hosts.
mod_perl.so installed, in httpd.conf added.
Code:
LoadModule perl_module libexec/apache22/mod_perl.so
But then it is not clear which directives or options to include, taking into account virtual hosts, so that, for example, the test file
index.pl executed apache24 and displayed correctly in browser.
 
Need to enable support Perl on Apache24 with virtual hosts.
mod_perl.so installed, in httpd.conf added.
Take a really close look at the line you added. It points to apache22, that's not correct, that should be apache24.
 
I accidentally made a mistake in the message text.
Certainly,
LoadModule perl_module libexec/apache24/mod_perl.so

Still, how enabled support Perl on Apache24.
 
lucas1 Have you checked this out? Assuming you have the perl module installed (ap24-mod_perl2), module enabled as you mentioned you do need to enable CGI and add the handler. Execution of the perl script is done differently to php.
Edit: it's worth sharing the link mod_perl package ships with itself: start fast
 
Did so far:

I also found the method you specified,, but generally, apache24 goes into an error when executing .pl and this
displays in browser a message about something like "misconfigured server".


And yes. +ExecCGI it is necessary in a separate line.
 
I pulled the vanilla VM image, installed apache24 and ap24-mod_perl2. Changes I did:
Code:
root@freebsd13:/usr/local/etc/apache24 # diff -w httpd.conf httpd.conf.sample
166c166
<       LoadModule cgid_module libexec/apache24/mod_cgid.so
---
>       #LoadModule cgid_module libexec/apache24/mod_cgid.so
169c169
<       LoadModule cgi_module libexec/apache24/mod_cgi.so
---
>       #LoadModule cgi_module libexec/apache24/mod_cgi.so
262a263,264
>     #
>     Options Indexes FollowSymLinks
264,268d265
<       SetHandler perl-script
<       PerlResponseHandler ModPerl::Registry
<       PerlOptions +ParseHeaders
<       Options Indexes FollowSymLinks ExecCGI
<
434c431
<     AddHandler cgi-script .cgi .pl
---
>     #AddHandler cgi-script .cgi
root@freebsd13:/usr/local/etc/apache24 #
I uncommented the loadmodule in /usr/local/etc/apache24/modules.d/260_mod_perl.conf.
I created a test /usr/local/www/apache24/data/test.pl:
Code:
#/usr/bin/env perl

print "Content-type: text/html\n\n";
print "<h2>this is a test</h2>\n";
print "$^O\n";
And it was working.
 
Hm, interesting. Typo in the script, not in my post. It seems the module that handles the perl is calling the perl interpreter. So the whole shebang line can be omitted. I guess perl module sees the whole line as comment as it starts with #.
 
Yeah, it will always invoke the perl handler because of the SetHandler perl-script. So the shebang isn't really needed, but it's good form to keep it.
 
Back
Top