Solved

500 Internal Server Error and Premature End of Script Headers

Posted on 2004-08-20
5
191 Views
Last Modified: 2013-12-25
Hi,

This is driving me crazy. I downloaded a CGI script and it absolutely refuses to run. I'm a CGI "newbie", but I have done the following things:

1. CHMOD'd everything right (Directory & CGIs 755, pm 644)
2. Added the Header and "use strict;" (those weren't there before)
3. Checked the logs.

Yet it STILL gives a 500 Internet Server Error.

The log reads:
[Fri Aug 20 14:21:14 2004] [error] [client 68.41.173.155] Premature end of script headers: /www/o/p/optimizexp.net/cgi-bin/autoresponder/ar.cgi

The source is at:
http://www.keinetworks.org/arsource

Thanks a lot!
0
Comment
Question by:ksg455
  • 2
  • 2
5 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 11864558
Have you checked that the ar.cgi has the correct format on the unix-platform. That file may not be saved in DOS-mode with CR/LF

If you have shell-access to that server do a
cat -e ar.cgi | head -1
If you get something like the following:
#!/usr/bin/perl^M$
The file has the wrong format it should print
#!/usr/bin/perl$

If you have no shell-access make sure your program that uploads the ar.cgi converts the CL/LF TO LF only
0
 

Author Comment

by:ksg455
ID: 11865274
[root@smeserver autoresponder]# cat -e ar.cgi | head -1
#!/usr/bin/perl^M$
[root@smeserver autoresponder]# cat -e config.cgi | head -1
#!/usr/bin/perl^M$
[root@smeserver autoresponder]# cat -e activate.cgi | head -1
#!/usr/bin/perl^M$
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 230 total points
ID: 11865428
so your scripts are in dos-format and the interpreter can't be found. you have to recode them. Then the scripts should work. To recode use

dos2unix ar.cgi
dos2unix config.cgi
..

if dos2unix is not installed try the following:
recode ibmpc..lat1 ar.cgi
recode ibmpc..lat1 config.cgi
...

maybe you also need to remove some of the prints you added in various files to get it work
0
 
LVL 5

Expert Comment

by:Peewee
ID: 11868408
ksg455,
since you've added the use strict, you should also run a perl -c on the unix command line to check for any addittional syntax errors.  

Peewee
0
 

Author Comment

by:ksg455
ID: 11869287
hernst42, that did the trick. It works now. Thanks!!
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
The viewer will learn how to dynamically set the form action using jQuery.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question