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.

Recommended Answers

All 4 Replies

Please disregard this post, I've figured it out!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.