Why does my script display a "500 internal server error" message?
If your use a script that displays a “500 Internal Server Error” message, you can often find more details in the error log for your site. To view recent lines from the error log:
- Login to the “My Account” control panel (having trouble?)
- Click Statistics and Logs
- View the “Web site error logs” section
(Older error log entries are also available via FTP or the Unix shell.)
The rest of this page has more tips:
- Getting more information for PHP scripts
- Getting more information for Perl or Python scripts
- Other causes of internal server errors
Getting more information for PHP scripts
Production PHP servers no longer show errors in the browser by default for security reasons, as described on this page. As it says, the option to show errors in the browser “is a feature to support your development and should never be used on production systems (e.g. systems connected to the internet).”
In some situations, PHP will even return a fake “500 Internal Server Error” and display a blank page when it has a problem, instead of showing you the error.
You can add this line to your php.ini settings to see the errors in your browser instead:
display_errors = On
But keep in mind that if the error messages include any sensitive information (such as passwords), doing this might allow other people to see that information. You should disable this setting when you’ve fixed the problem.
Getting more information for Perl or Python scripts
The most common reason for an “Internal Server Error” message is that you've uploaded a script in the wrong "mode" in your FTP program. In particular, Perl and Python scripts should always be uploaded in "ASCII" or "text" mode, not "binary" mode.
Our CGI Script Checker will tell you if a script has been uploaded in the wrong mode. If that's the problem, see the documentation that comes with your FTP program to learn how to change the mode, then re-upload your script.
(The Script Checker can also catch other common problems, such as the first line of the script having the wrong "path". Always try the Script Checker first if you have trouble.)
If that didn't help, and your script is a Perl or Python script, you can modify the script slightly so that your Web browser shows you the actual error. For detailed instructions, see the sections of our Perl page and Python page that discuss internal server errors. We also have extra tips on debugging Perl scripts.
Other causes of internal server errors
Another common cause of "internal server error" messages is creating a .htaccess file that contains syntax errors or unsupported commands such as "php_value". If you've created a .htaccess file, try removing it to see if that solves the problem.
If that doesn't help, the file may have incorrect "line endings". It's possible to convert the line endings to fix this.