Enable CGI and use Perl script.
[1] Install Perl.
[root@futurelinux ~]# dnf install perl perl-CGI -y
[2] By default, CGI is allowed under the [/var/www/cgi-bin] directory. It's possible to use Perl Scripts to put under the directory. All files under it is processed as CGI, though.
[root@futurelinux ~]# grep -n "^ *ScriptAlias" /etc/httpd/conf/httpd.conf
250: ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"
[3] If you'd like to allow CGI in other directories, configure like follows. For example, allow in [/var/www/html/cgi-enabled].
[root@futurelinux ~]# vi /etc/httpd/conf.d/cgi-enabled.conf
# create new
# processes .cgi and .pl as CGI scripts
<Directory "/var/www/html/cgi-enabled">
Options +ExecCGI
AddHandler cgi-script .cgi .pl
</Directory>
[root@futurelinux ~]# mkdir -p /var/www/html/cgi-enabled
[root@futurelinux ~]# systemctl restart httpd
[4] If SELinux is enabled and also enable CGI except default location like above, add rules like follows.
[root@futurelinux ~]# dnf install checkpolicy policycoreutils-python-utils -y
[root@futurelinux ~]# semanage fcontext -a -t httpd_sys_script_exec_t /var/www/html/cgi-enabled
[root@futurelinux ~]# restorecon /var/www/html/cgi-enabled
[5] Create a CGI test page and access to it from client PC with web browser. It's OK if following page is shown.
[root@futurelinux ~]# vi /var/www/html/cgi-enabled/index.cgi
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print "CGI Test Page\n";
[root@futurelinux ~]# chmod 705 /var/www/html/cgi-enabled/index.cgi