[wellylug] Perl scripts not executing in Firefox
Jim Cheetham
jim at gonzul.net
Thu Jan 11 12:55:24 NZDT 2007
On Thu, Jan 11, 2007 at 11:36:56AM +1300, John Durham wrote:
> While testing server systems this morning, I found that a perl script
> such as this:
>
> #!/usr/bin/perl
>
> print "Content-type: text/html\n\n";
> print "Hello, world!\n";
>
> exit;
>
> This will execute in at the root command prompt, but when invoked in
> Firefox, it just lists as plain text. Other scripts respond the same
> way. Some insight on this would help get the website functions operational.
Your webserver (apache) doesn't know that the URL you have asked for is
supposed to be executed - instead it's treatingit as "just another file
that has to be returned".
You need to be able to tell apache the difference between normal files,
and programs.
One way to do this is to put the program into the already-declared CGI
directory (look for the declaration of "/cgi-bin" in your apache
configs).
Another way would be to give the script a suffix that you will not use
for any other type of object, such as "hello.cgi", and then tell apache
that all files ending with ".cgi" are to be executed. (This is basically
what you do when you have "index.html" and "image.jpg")
-jim
More information about the wellylug
mailing list