Perl Tutorials - Herong's Tutorial Examples - Version 5.40, by Dr. Herong Yang
500 Internal Server Error
This section provides a tutorial on how to troubleshoot the '500 Internal Server Error'. Several common causes of this error are listed.
When you develop and test your Perl scripts with the Apache server, it is quite often that you will get the "500 Internal Server Error" in your browser. The error message says:
Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, herong@localhost and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log.
As suggested in the error message, I looked at the error log file located at C:\local\apache\logs\error.log and see several different causes of the "500 Internal Server Error":
1. Missing path name of "perl.exe", #!\local\perl\bin\perl.exe, in the Perl script when the error log file says. The solution is to add the path name prefixed with #! as the first line.
...C:/local/apache/cgi-bin/hello_missing_path.pl is not executable; ensure interpreted scripts have "#!" first line ...(9)Bad file descriptor: don't know how to spawn child process: C:/local/apache/cgi-bin/hello_missing_path.pl
2. Wrong path name of "perl.exe", #!\local\xxx\bin\perl.exe, in the Perl script when the error log file says. The solution is to correct the path name.
...(OS 3)The system cannot find the path specified. : couldn't create child process: 720003: hello_wrong_path.pl ...(OS 3)The system cannot find the path specified. : couldn't spawn child process: C:/local/apache/cgi-bin/hell...
3. Wrong option for "perl.exe", #!\local\perl\bin\perl.exe -bad, in the Perl script when the error log file says. The solution is to remove or correct options after the path name.
...Premature end of script headers: hello_wrong_option.pl ...Unrecognized switch: -bad (-h will show valid options).\r
The picture below shows you how the "500 Internal Server Error" is displayed in the browser.
Last update: 2014.
Table of Contents