Failed to set up Apache for executing PERL file in FreeBSD

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?


Solution 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