httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Krist van Besien" <krist.vanbes...@gmail.com>
Subject Re: [users@httpd] problem with perl script and Apache
Date Mon, 02 Jun 2008 14:31:09 GMT
On Mon, Jun 2, 2008 at 2:44 PM, Octavian Rasnita <orasnita@gmail.com> wrote:

> At the beginning of the output generated by your script, you should do:
>
> print "Content-Type: text/html\n\n";

Exactly.

A minimal script would be:

#!/usr/bin/perl

print "Content-type: text/html\n\n";
print <<HTML;
<html>
<body>
<p>Hello World</p>
</body>
HTML
exit;

And this would, when executed on the command line, output:

Content-Type: text/html

<html>
<body>
<p>Hello World</p>
</body>

The Content-Type is importan, because it allows your apache server to
know what the script will output. (CGI scripts can produce whatever
you fancy. I have scripts that produce PNGs and SVGs for example...)

Krist

-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message