Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 152
  • Last Modified:

displaying html code

I am setting up a script, and I am having probs!

when I type
perl script.pl  (or ./register.pl)

----------------\
Content-type: text/html

 <HTML><HEAD><TITLE>Form Incomplete</TITLE></HEAD>
<BODY>
....
</BODY></HTML>
-----------------/

but when I run it from my browser, I get:

-----------------\
500 Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your request.

Please contact the server administrator, webmaster@cheathouse.com and
inform them of the time the error occurred , and anything you might have
done that may
have caused the error.

Error: HTTPd: malformed header from script
/usr/local/etc/httpd/cgi-bin/library/register/register.pl
------------------/

What could be wrong? Any help is greatly appreciated.

Jens Schriver
0
lovkraft
Asked:
lovkraft
  • 2
1 Solution
 
alamoCommented:
Even though the header looks fine when you run it locally and post it here, the header is the problem.

Could it be that due to bad program logic the "Content-type: text/html" header never gets written when it's run from the web?

Or could there be no blank line after it, i.e. you need
print "Content-type: text/html\n\n";    # note \n\n

To help debug this put the following line as the 2nd line in your file, so good headers are guaranteed. You can then see in text form what your program is writing, and it should be obvious why the server is rejecting your headers.

print "Content-type: text/plain\n\n";

0
 
alamoCommented:
lovkraft, whatever happened with this? Did you get it working? If not we'll be happy to try to help further. If so - please grade this question (or reject my answer if was something else). Thanks and good luck!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now