NOTE: document root is mywebsite
cgi-bin directory with 755 permissions (recursive)
cgi-bin/testPerl.pl confirmed also with 755 permissions
So, after reading up on this and checking various online guidance, I further configured Apache2 thus:-
Within etc/Apache/Apache.conf, I added the following section :-
NOTE: I've noticed that /usr/lib/cgi-bin was setup by Apache2 as an empty directory. Also, there is no such File System/cgi-bin directory.
and then restarted Apache.
Access logs
127.0.0.1 - - [31/Aug/2025:20:57:49 +0100] "GET /public_html/home2.htm HTTP/1.1" 200 5038 "http://localhost.mywebsite/" "Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0"
127.0.0.1 - - [31/Aug/2025:20:58:07 +0100] "GET /cgi-bin/testPerl.pl HTTP/1.1" 404 504 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0"
127.0.0.1 - - [31/Aug/2025:21:02:28 +0100] "GET /cgi-bin/testPerl.pl HTTP/1.1" 404 504 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0"
NOTE: If I comment out the new section I added within Apache.conf, browser returns to displaying the testPerl.pl script again rather than executing it.
I'd put off trying to get Perl CGI scripts to work on the local site because deep down I feared something like this was likely to stump me. I was right. I'm now lost, despondent, and don't know what else to do
Could someone please help if possible?
localhost.mywebsite correctly displays the home pagelocalhost.mywebsite/cgi-bin/testPerl.pl displayed the perl script rather than execute itcgi-bin directory with 755 permissions (recursive)
cgi-bin/testPerl.pl confirmed also with 755 permissions
So, after reading up on this and checking various online guidance, I further configured Apache2 thus:-
Within etc/Apache/Apache.conf, I added the following section :-
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory "/usr/lib/cgi-bin"> AllowOverride None Options +ExecCGI AddHandler cgi-script .cgi .pl .py .sh .rb .go .js .php Require all granted </Directory>NOTE: I've noticed that /usr/lib/cgi-bin was setup by Apache2 as an empty directory. Also, there is no such File System/cgi-bin directory.
and then restarted Apache.
localhost.mywebsite/cgi-bin/testPerl.pl now displays Not Found ... doh!Access logs
127.0.0.1 - - [31/Aug/2025:20:57:49 +0100] "GET /public_html/home2.htm HTTP/1.1" 200 5038 "http://localhost.mywebsite/" "Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0"
127.0.0.1 - - [31/Aug/2025:20:58:07 +0100] "GET /cgi-bin/testPerl.pl HTTP/1.1" 404 504 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0"
127.0.0.1 - - [31/Aug/2025:21:02:28 +0100] "GET /cgi-bin/testPerl.pl HTTP/1.1" 404 504 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0"
NOTE: If I comment out the new section I added within Apache.conf, browser returns to displaying the testPerl.pl script again rather than executing it.
I'd put off trying to get Perl CGI scripts to work on the local site because deep down I feared something like this was likely to stump me. I was right. I'm now lost, despondent, and don't know what else to do
Last edited:

