Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Premature end of script

by Phaysis (Pilgrim)
on Aug 13, 2002 at 07:25 UTC ( [id://189720]=note: print w/replies, xml ) Need Help??


in reply to Premature end of script

Baz-

Several things could happen when you get this error in your server log. Most times, the answer is transparently under your nose. Assuming you are running Perl under Apache on Linux, here is a quick checklist:

First - source code: make sure each line of code in your script is terminated by the proper newline for the platform you're on; if you're on *Nix, use only linefeeds "<LF>", not "<CR><LF>" as you would use on Win32 or "<CR>" as you would use on Mac. Transferring your script via FTP in ASCII mode would solve this.

Second - permissions: make sure your webserver has world-read and world-execute permission to run this script. Try chmod +755.

Third - headers: make sure your script first outputs the proper HTTP headers before any document data is output. One of those headers must be the Content-Type: header, whose value is the mime-type of the document your script outputs (usually "text/html"). The HTTP headers must be seperated from the document body by two linefeeds to tell the server that you are finished outputting the headers. The web server will cough if it cannot determine the mime type; it needs to communicate this to the user agent.

Premature end of script headers is a very vague and confusing term, yes. Bitten me several times. These considerations have always helped me recover.

-Shawn
(Ph) Phaysis
If idle hands are the tools of the devil, are idol tools the hands of god?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://189720]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2025-06-21 13:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.