Why are my Perl scripts failing with ’Error 500: Internal Server Error’?

If your Perl script is returning an Error 500, there are a few steps you can take to find out what the problem is.

FTP Settings

Check that you have uploaded the script through FTP in ASCII mode, not Binary.

Interpreter Path

Make certain that the interpreter path on the first line of the script is:

#! /usr/bin/perl

File Extension

Ensure that the script’s filename ends In either a .pl or a .cgi.

File Permissions

All scripts should have a file permission of 755 or rwxr-xr-x. This means that the owner can read, write, and execute the script, and all others can read and execute the script.

Print Errors to Browser

In the second line of your script (after the interpreter path), put this line:

use CGI::Carp qw(fatalsToBrowser);

This prints the error in your browser window instead of the existing ‘500 Internal Server Error’ page.

Check the Error Logs

In your eXtend Control Panel, you can check the error logs for your site in ‘Log File Download' under 'Web Stats & Logs'.

Article ID: 412
Created On: Mon, Mar 16, 2015 at 3:23 PM
Last Updated On: Thu, Apr 23, 2015 at 12:27 PM

Online URL: https://www.heartinternet.uk/support/article/why-are-my-perl-scripts-failing-with-error-500-internal-server-error.html