Debugging your Perl scripts

This article applies to 123-reg Linux Shared Hosting packages.

If you encounter an error "500 Internal Server Error" whilst running your CGI perl scripts, try the following in order:

  • Ensure you have uploaded the script through FTP using ASCII mode, or that it has Unix-style carriage returns.
  • Check the perl interpreter on the first line of the script. It should always be "#!/usr/bin/perl".
  • Make sure the script filename ends in either ".pl" or ".cgi".
  • Make sure the script can execute. It should have mode "0755". You can change this in your file manager - set the mode to user read+write+execute, group read+execute, other read+execute. Most FTP clients also support this.
  • Put "use CGI::Carp qw(fatalsToBrowser);" into the second line of your script. This will make perl print the error instead of the "500 Internal Server Error" page, and will allow you to find out where your script is breaking.

Answer options

Your feedback was successfully added.

Answer tracking

Track

Watch the content of this article for changes.