Score:0

Run a perl script in a browser via a link

mq flag

I'm attempting to get a perl script up and running on Oracle Linux 8.5.

My Apache server and virtual hosts work with static html.

My test virtual host, fnu, has a very basic perl script named hw.pl in /var/www/fnu:

#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "Hello, World. This is fnu.";

I have a link from index.html to hw.pl, permissions open and owner set to apache:

-rwxrwxrwx. 1 apache apache 89 Jun 4 20:59 hw.pl
lrwxrwxrwx. 1 apache apache 5 Jun 4 20:59 index.html -> hw.pl

Here's the site config in /etc/httpd/conf.d:

<VirtualHost *:80>
DocumentRoot "/var/www/fnu/"
ServerName fnu.[obscured].net
ServerAlias fnu
ErrorLog /var/log/fnu/error.log
CustomLog /var/log/fnu/request.log combined
</VirtualHost>

<Directory "/var/www/fnu">
Options +ExecCGI +SymLinksIfOwnerMatch
AddHandler cgi-script .cgi .pl
</Directory>

If I point a browser to fnu/hw.pl, I get the result I expect - the script output. If I point the browser to fnu/, I get the contents of the file. So, it's following the link, but it's not running it as a perl script once it gets there. Nothing useful in /var/log/fnu/error.log.

SELinux is set to Permissive.

I appreciate any assistance.

Script output as expected

Script file contents

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.