Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Premature End of Script Headers

by Anonymous Monk
on Jun 29, 2002 at 21:26 UTC ( [id://178264]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I just switched web hosts. When I run a CGI (in Perl) I get a 500 error due to a "Premature End of Script Headers". I know it's not the script, even
#!/usr/local/bin/perl print "Content-type: text/html\n\n"; print "Hello!\n";
generates an error. What's going on?

Replies are listed 'Best First'.
Re: Premature End of Script Headers
by mikeirw (Pilgrim) on Jun 29, 2002 at 21:41 UTC
    Check that you've uploaded the file as ASCII and not binary. Also, check that the path to Perl is correct, and that the script has the proper permissions set on it.
Re: Premature End of Script Headers
by Aristotle (Chancellor) on Jun 29, 2002 at 21:48 UTC

    Did you upload in ASCII? Are the permissions correct? Is the perl binary really at /usr/local/bin/perl?

    Update: Doh, I should refresh threads before replying. To add something of actual value, I'll mention The Idiot's Guide to Solving Perl CGI Problems. The tone is, well, not exactly the friendliest possible, and a scant few points need updating, but it's an extremely comprehensive compilation of all the little traps one may run into when trying to run a CGI script. Odds are (just like it says) that 99% of the time just checking all the questions there will fix the problem.

    Update 2: Doh! Beaten to the punch again. Sigh :)

    Makeshifts last the longest.

Re: Premature End of Script Headers
by samtregar (Abbot) on Jun 29, 2002 at 22:39 UTC
    What happens when you run the script from the command-line on the web server? Maybe perl isn't installed in /usr/local/bin/perl.

    -sam

Re: Premature End of Script Headers
by dorko (Prior) on Jun 29, 2002 at 22:28 UTC
    It might not help you, but you might want to take a look at this.

    Cheers!

    Brent

    -- Yeah, I'm a Delt.

Re: Premature End of Script Headers
by George_Sherston (Vicar) on Jun 29, 2002 at 23:44 UTC
    Another possibility, if your local machine is running Windows, is that your script contains MS line breaks, and your new host can't deal with them. The solution to this is to get a text editor (e.g. editplus) that makes these visible, then search and replace.

    § George Sherston
      IIRC, most FTP clients automatically do line break conversion if uploading/downloading in ASCII mode.
        Most, but by no means all, as I know to my cost - and if they don't do it, they also don't tell you they didn't.

        § George Sherston

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-25 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found