I am trying to learn CGI programming in PERL. I have a simple test page that I want to try out, but when I upload it and try to display it as a web page, all I get is the source code. Can anyone help me out? I'm not sure what file extension to use (.cgi, .pl, or html), or if it should have a #! line to point it to the perl executable. I'm a true beginner, so I'd really appreciate any help.

8 Years
Discussion Span
Last Post by d5e5

I'd still really like to know though, because I have the same problem.

How did you figure it out?


This is a configuration issue. If you put the perl script in the cgi directory and MAKE IT EXECUTABLE by the server user and use a .cgi extension, it should work fine.


I agree with mitchems. Just as a further note, the mistake may have included putting the cgi scripts in the same directory as the html documents. Simon Cozens warns against this (even if you succeed in making them executable).

The reason for keeping scripts out of the document hierarchy is to avoid the risk of the source code to our scripts being made available by the web server. ~from Beginning Perl

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.