CGI (Common Gateway Interface) scripts allow web servers to run external programs, often written in Perl, Python, or other languages. On ruachost.com, CGI scripts run under your user ID, so proper configuration is essential for them to work correctly.

 

Common Issues and Fixes

Step 1: Verify Script File Permissions

  • CGI scripts must have execute permissions.

  • Set permissions using:

    Bash
    
    chmod 755 script.cgi
    
  • Incorrect permissions are one of the most common causes of failure.

 

Step 2: Verify the Shebang Line

  • The first line of your script must specify the correct interpreter.

  • Example for Perl:

    Bash
    
    #!/usr/bin/perl
    
  • If the shebang is missing or incorrect, Apache won’t know how to run the file.

 

Step 3: Run the Script from the Command Line

  • Debugging through a browser often hides useful error messages.

  • Log in via SSH and run:

    Bash
    
    ./script.cgi
    
  • This will display syntax errors or missing module issues directly.

 

Step 4: Check Web Server Error Logs

  • Errors such as 500 Internal Server Error or 403 Forbidden are logged.

  • Access logs via cPanel → Metrics → Errors or SSH:

    Bash
    
    tail -100 /var/log/apache2/error.log
    
  • Review logs for permission issues, syntax errors, or misconfigurations.

 

Step 5: Contact Support

  • If all else fails, open a Support Ticket.

  • Provide details: script name, error messages, and steps you’ve tried.

  • The Ruachost support team can assist further.

Important Notes

  • Always upload scripts in ASCII mode if using FTP.

  • Ensure scripts are placed in the correct directory (e.g., /cgi-bin).

  • Avoid Windows line endings (\r\n) — use Unix line endings (\n).

  • Test scripts incrementally to isolate issues.

 
Je li Vam ovaj odgovor pomogao? 0 Korisnici koji smatraju članak korisnim (0 Glasovi)

Powered by WHMCompleteSolution