Click to See Complete Forum and Search --> : How to use a perl CGI script on the web?


CMSHelper
05-19-2010, 04:05 AM
Hi

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 please? 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.

Thanks

sohguanh
05-19-2010, 07:40 PM
Hi

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 please? 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.

Thanks

First is the Web server yours or you host at some sites ? From what I know due to security concerns, some hosted Web server Administrators have turned off the capability to run CGI scripts. This mean not only Perl CGI, but C, C++ etc etc CGI cannot be run!

Second, depending on the Web server config there is a specified directory for you to put your CGI scripts in. Also that directory must have execute permission to run the program.

Third, generally for Perl script we have a #!/usr/local/bin/perl to give some "guidance" for the script to know where to find the Perl interpreter to execute the Perl code.