The server is a VPS running CentOS 7 64bit with CyberPanel. Perl is already present (ver 5.16.3) and will run scripts from the command line.
However, clicking a link to a Perl script just results in the browser attempting to download the script file.
I have tried modifying the $PATH on the server. I have updated Perl and attempted to add modules involved in CGI such as httpd and Perl-CGI but they were already present. Oh, and the scripts' permissions are set to allow execution.
If necessary, server set-up can be rerun to start over clean and there are even choices of Linux operating systems if something other than CentOS 7 64bit would be a better option.
I have googled a lot of info and it seems there are configuration files that may need to be edited but different sources referenced different files and that was never the only step. I could not seem to find info directly related to my situation. Efforts to adapt the available info to this situation have been unsuccessful.
I am not a professional but have been programming in Perl and creating and maintaining websites on "managed" servers for more than 20 years. This is an unmanaged server. So, I need information to set up cgi myself.
If that info is already on this site, please advise. My searches were unsuccessful. Otherwise, any help would be appreciated.
No doubt, additional information may be necessary to provide assistance and I will try to respond to any requests as quickly as possible.
1st edit to add/clarify
First - Thanks for the assistance.
Found /etc/httpd/conf.modules.d/XX-cgi.conf (actual file=01-cgi.conf) and verified the LoadModule line is present and not commented out. It is actually in a conditional statement:
<IfModule mpm_worker_module>
LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_event_module>
LoadModule cgid_module modules/mod_cgid.so
</IfModule>
<IfModule mpm_prefork_module>
LoadModule cgi_module modules/mod_cgi.so
</IfModule>
Added the Options +ExecCGI and AddHandler cgi-script .cgi .pl commands to the httpd.conf file in the appropriate Directory directive that also included AllowOverride None and Require all granted.
<Directory "/home/wannabesports.site/public_html/games/cgi-bin/">
AllowOverride None
Options +ExecCGI
AddHandler cgi-script .cgi .pl
Require all granted
</Directory>
Per the Apache Tutorial, a SciptAlias command was also modified to point to the appropriate directory:
ScriptAlias /cgi-bin/ "/home/wannabesports.site/public_html/games/cgi-bin/"
The systemcfl restart command fails
Job for httpd.service failed because the control process exited with error code. See "systemctl status httpd.service" and "journalctl -xe" for details.
So, I did a VPS reboot from the host's hPanel which may not have been a sufficient alternative as the problem persists. If you can provide any additional insight, it would be appreciated.
Also, is there any clue in the fact that a URL pointing to a script file results in the browser downloading that file rather than printing it out or displaying an error?
2nd edit to add/clarify
Ran the commands to see the error and received the following:
[root@WANNABEsports /]# systemctl status httpd.service -l
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Thu 2023-03-23 06:21:48 UTC; 3min 23s ago
Docs: man:httpd(8)
man:apachectl(8)
Process: 14999 ExecStart=/usr/sbin/httpd $OPTIONS -DFOREGROUND (code=exited, status=1/FAILURE)
Main PID: 14999 (code=exited, status=1/FAILURE)
Mar 23 06:21:48 WANNABEsports.name systemd[1]: Starting The Apache HTTP Server...
Mar 23 06:21:48 WANNABEsports.name httpd[14999]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address [::]:80
Mar 23 06:21:48 WANNABEsports.name httpd[14999]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:80
Mar 23 06:21:48 WANNABEsports.name httpd[14999]: no listening sockets available, shutting down
Mar 23 06:21:48 WANNABEsports.name httpd[14999]: AH00015: Unable to open logs
Mar 23 06:21:48 WANNABEsports.name systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 23 06:21:48 WANNABEsports.name systemd[1]: Failed to start The Apache HTTP Server.
Mar 23 06:21:48 WANNABEsports.name systemd[1]: Unit httpd.service entered failed state.
Mar 23 06:21:48 WANNABEsports.name systemd[1]: httpd.service failed.
and . . .
[root@WANNABEsports /]# journalctl -xe
--
-- Unit httpd.service has begun starting up.
Mar 23 06:21:48 WANNABEsports.name httpd[14999]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address [::]:80
Mar 23 06:21:48 WANNABEsports.name httpd[14999]: (98)Address already in use: AH00073: make_sock: unable to listen for connections on address 0.0.0.0:80
Mar 23 06:21:48 WANNABEsports.name httpd[14999]: no listening sockets available, shutting down
Mar 23 06:21:48 WANNABEsports.name httpd[14999]: AH00015: Unable to open logs
Mar 23 06:21:48 WANNABEsports.name systemd[1]: httpd.service: main process exited, code=exited, status=1/FAILURE
Mar 23 06:21:48 WANNABEsports.name systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit httpd.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit httpd.service has failed.
--
-- The result is failed.
Mar 23 06:21:48 WANNABEsports.name systemd[1]: Unit httpd.service entered failed state.
Mar 23 06:21:48 WANNABEsports.name systemd[1]: httpd.service failed.
Mar 23 06:21:48 WANNABEsports.name sudo[14995]: pam_unix(sudo:session): session closed for user root
I can see both contain reference to failure but don't understand what's needed to correct the situation.
3rd edit to add/clarify
I believe this server is running openlitespeed rather than apache. How does that effect what's needed to get CGI working?