How to solve "500 Internal Server Error" with cgi/Perl scripts

In our servers, CGI/Perl is enabled for all accounts. However, if these files need direct access, make sure to place in the cgi-bin folder. If you get any internal server error, it can be due to various factors. Please check the steps below to help you to solve the errors.

  1. Check the Directory permissions.Your cgi-bin directory should be chmodded as 0755, not 0777 or 0700. Similarly if your script is at .../cgi-bin/foo/bar.cgi, the foo directory must not be world-writable (0777).  This is because many servers will refuse to execute CGI scripts within world-writable directories, as a security precaution.
  2. Check the File Permissions.Your CGI script itself must also be 0755 and not 0777, for the same reasons.
  3. Check the  File Transfer mode in your FTP client, if the script is giving unexpected errors.
  4. If you are using FTP to transfer the CGI script to your server, then your FTP client is probably set to AUTO transfer mode; that is, it will try to figure out whether to use BINARY or ASCII mode without asking you. But depending on whether your CGI script came from a Windows or UNIX system, and whether it's going to a Windows or UNIX system, you may need to manually set your FTP client to use either ASCII or BINARY mode before transferring your CGI script. Try one and then the other.

Having trouble? Contact us and our team will be happy to help.

How did we do?