Solved

500 Internal Server Error and Premature End of Script Headers

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

740 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