0

I've successfully installed perl5 and apache24 in FreeBSD 12. Then I enabled apache24 in /etc/rc.conf and see index.html placed in the path /usr/local/www/apache24/data. Then in the file /usr/local/etc/apache24/httpd.conf I've uncommented the line

AddHandler cgi-script .cgi

inside of the <IfModule mime_module> and also added .pl at the end of the line.

Then I added in the same file the line

Options FollowSymLinks +ExecCGI

after the line

Options Indexes FollowSymLink

and restart Apache, but received the error

Either all Options must start with + or -, or no Option may

So I added the line without FollowSymLink and restart Apache without any errors. But if I follow by the link like mydomain.com/test.pl I still see my PERL code displayed as plain text instead of its executing.

My PERL code is

#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "Hello world!";

If I run the code in command line by the command perl /usr/local/www/apache24/data/test.pl I receive my two lines i.e. Content-type: text/html and Hello world!. The file has permissions 755.

What else can I do to resolve the problem?

1 Answer 1

1

Ok, I've uncommented in httpd.conf also the line

LoadModule cgi_module libexec/apache24/mod_cgi.so

and now the code is executed successfully

2
  • I'm glad you figured this out and thanks for sharing your solution. It might also be worth noting that the extension of your AddHandler is different than the file you are trying to run.
    – chicks
    Jun 25, 2021 at 14:10
  • Yes, I know. As I mentioned in the question, I added .pl to AddHandler and my file is test.pl
    – stckvrw
    Jun 30, 2021 at 12:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .