If your CGI (Common Gateway Interface) script isn't working, try the following troubleshooting steps:
Step 1: Check the script file permissions.
CGI scripts are launched by Hostginger Hosting's shared web servers using your user ID. One of the most typical reasons why a CGI script does not run is that the execute permission on the file is not set. Check that the CGI script file has the appropriate permissions.
Step 2: Verify the shebang.
Check that the shebang in the CGI script file is valid. CGI script files must begin with the right shebang, else the Apache web server will fail to recognize the file.
Step 3: Use the command line to run the script.
Trying to debug a CGI script in a web browser can be a tedious experience. If you get a "500 Internal Server Error," for example, the fundamental problem could be file permissions, a syntax mistake, or something else entirely. Logging in to your SSH account and running the script from the command line will provide you with much more helpful information regarding script problems.
Step 4: Examine the web server error logs.
The error log on the web server may give useful information about why a CGI script is not functioning. Scripts that generate a "500 Internal Server Error" or "403 Forbidden" error message are recorded in the error log of the web server. You may view your website's error log using cPanel.