How to troubleshoot CGI scripts

This article lists troubleshooting steps you can take to determine why a CGI script is not working.

Troubleshooting CGI scripts

If you have a CGI (Common Gateway Interface) script that is not working, you can follow these troubleshooting steps:

Step #1: Verify script file permissions

A2 Hosting's shared web servers run CGI scripts under your user ID. If a CGI script does not run, one of the most common causes is that the execute permission is not set on the file. Make sure that the CGI script file has the correct permissions set.

For more information about file permissions for Perl script files, please see this article.


Step #2: Verify the shebang

Make sure the CGI script file uses the correct shebang. CGI script files must start with the correct shebang, or else the Apache web server will not know how to run the file. For more information about the shebang and how to use it, please see this article.

Step #3: Run the script from the command line

Trying to debug a CGI script through a web browser is often a frustrating process. For example, if you receive a “500 Internal Server Error”, the root cause could be file permissions, a syntax error, or something else entirely. You can obtain much more useful information about script errors by logging in to your SSH account and running the script from the command line.

Step #4: Check web server error logs

The web server's error log may contain valuable information about why a CGI script is not running. Scripts that cause a “500 Internal Server Error” or “403 Forbidden” error message are logged in the web server's error log. You can use cPanel to view the error log for your web site.

Step #5: Open a ticket with the Guru Crew

When your best attempts to fix a CGI script are unsuccessful, hope is not lost. If you need further assistance, please open a support ticket with our Guru Crew on the Customer Portal at

Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.

We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.