apache tutorial - Troubleshooting CGI Scripts - apache - apache web server - apache server - apache2
How to troubleshoot CGI scripts
Learn Apache - Apache tutorial - flow cgi - Apache examples - Apache programs
- 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.
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.
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 https://my.a2hosting.com.