Solved

500 Internal Server Error and Premature End of Script Headers

Posted on 2004-08-20
5
193 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
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…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

809 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