Search the FAQ Archives

3 - A - B - C - D - E - F - G - H - I - J - K - L - M
N - O - P - Q - R - S - T - U - V - W - X - Y - Z
faqs.org - Internet FAQ Archives

FAQ: Frequently Asked Questions about CGI Programming
Section - 4.3 Why do I get Error 500 ("the script misbehaved", or "Internal Server Error")

( Single Page )
[ Usenet FAQs | Web FAQs | Documents | RFC Index | Schools ]


Top Document: FAQ: Frequently Asked Questions about CGI Programming
Previous Document: 4.2 I'm having trouble with my headers. What can I do?
Next Document: 4.4 I tried to use (Content-Type|Location|whatever), but it appears in my Browser?
See reader questions & answers on this topic! - Help others by sharing your knowledge

Your script must follow the CGI interface, which requires it to print:
(1) One or more Header lines.
(2) A blank line
(3) (optional, but strongly advised) a document body.

This error means it didn't.

The Header lines can include anything that's valid under HTTP, but must
normally include at least one of the three special CGI headers:
	Content-Type
	Location
	Status

Example (a very minimal HTML page via CGI)
Content-Type: text/html			<= Header
					<= Blank Line
<title>HelloWorld</title>Hello World	<= Document Body

A common reason for a script to fail is that it crashed before printing
the header and blank line (or while these are buffered).  Or that it
didn't run at all: you _did_ try it from the commandline as well as
check the file permissions and server configuration, didn't you?

Another possible reason is that it printed something else - like an
error message - in the Headers.   Check error logs, put a dummy header
right at the top (for debugging only), check the "Idiot's Guide",
and use the debug mode of your CGI library.


User Contributions:

Comment about this article, ask questions, or add new information about this topic:

CAPTCHA