Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

500 Internal Server Error and Premature End of Script Headers

Posted on 2004-08-20
5
Medium Priority
?
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 920 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

636 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