Sample Header Ad - 728x90

How to set up web server with Perl CGI on Catalina

1 vote
0 answers
101 views
I've got an old MBP that's maxed out at MacOS 10.15.7 / Catalina, and I'm trying to use it as a web server capable of running Perl CGI scripts. Furthermore, I want to serve pages from **~/Sites**; I want to run the scripts with Perl 5.38, which I've installed under my home directory with perlbrew; I want to access the server from another machine on my LAN (i.e., not simply a localhost-only solution). One complication is that **homebrew** no longer officially supports Catalina, so I need to avoid trying a homebrew solution, and instead use Catalina-supplied things as much as possible (apart from Perl). I've managed to find enough instructions for configuring **/etc/apache2/*** so that pages are served from **~/Sites**, and I can access them from a different machine on the LAN. I've also been able to access a Perl script, **~/Sites/hello.pl**: #!/Users/chap/perl5/perlbrew/perls/perl-5.38.0/bin/perl print ""; print ""; print "Hello, World!"; print ""; print ""; print "

Hello, World!

"; my $version = $^V; print "Perl version: $version\n"; print ""; print ""; The output, when I browse **http://retsina.local/hello.pl** , is: Hello, World! Perl version: v5.18.4 So clearly the shebang line isn't being read, and I need to tell Apache to execute **perl** from a different location. Also, once I have that working, I expect there will be a lot more gotchas when I try to execute the real Perl script, which I've developed and tested in my own home directory while logged into my shell, with my own ENV, etc. Can someone provide some guidance here? I apologize for the lack of specificity -- this is mostly black magic to me. Glad to provide more details as requested.
Asked by Chap (1316 rep)
May 7, 2024, 05:27 PM