[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Single Page

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?


4.3 Why do I get Error 500 ("the script misbehaved", or "Internal Server Error")



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.




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?

Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
Nick Kew <nick@webthing.com>

Last Update October 22 2009 @ 05:36 AM

Some parts © 2009 Advameg, Inc.