> 1) Add a first line to my script (whereis perl):
> #! /usr/bin/perl

Correct.

> 2) and formatting the output in html-style:
> print "Content-type: text/html";
> print "<html>";

Almost.  You need 2 newlines after the content-type declaration.

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

And...

3) The script must be executable.


> But I dont get the results in the browser.
>I call the script from a html document using:
>
> <!--#exec cgi="cgi-bin/hello.pl">

This is different.  #2 above applies to CGI scripts (#1 and #3 also apply),
you do not need to do this here because this isn't a CGI script, it is a
server side exec (which only needs #1 and #3).

Also, the syntax is wrong... at least for apache.  Use "cmd", not "cgi"...
and use the full path to the file.

<!--#exec cmd="cgi-bin/hello.pl">

Also, a quick troubleshooting technique...  What happens when you run
"cgi-bin/hello.pl" (NOT "perl cgi-bin/hello.pl") at the command line?  If it
runs, then you should be ok, otherwise you have a problem.

Rob


-----Original Message-----
From: Chris San [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 08, 2003 5:42 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Basic problem w/a script on browser


How can I run a Perl Script on my browser?
Reading I found that I have to do only 2 things:

1) Add a first line to my script (whereis perl):
#! /usr/bin/perl

2) and formatting the output in html-style:
print "Content-type: text/html";
print "<html>";
...
etc.

But I dont get the results in the browser.
I call the script from a html document using:

<!--#exec cgi="cgi-bin/hello.pl">

The script simple never apear. It must print out
"Hello World!" in the browser (Netscape or
IE).

THX
C.S.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to