Login or Sign up Help | Site Map
Connecting Tech Pros Worldwide

CGI Script

Question posted by: jain236 (Member) on July 3rd, 2008 09:52 AM
Hi every body,

i am just new to the CGI scripting.
i am trying to run a basic CGI script . i am using APACHE as my web server .

i have placed my basic script inven.cgi in the web server and when i am trying to access my script with http://mydomain/inven.cgi
instead of getting the functionality of the script , i am seeing the whole script code on the web page.Do i need to do any setting to run the CGI script?

here is the code which i used

Code: ( text )
  1. use CGI qw/:standard/;
  2.   print header,
  3.         start_html('A Simple Example'),
  4.         h1('A Simple Example'),
  5.         start_form,
  6.         "What's your name? ",textfield('name'),p,
  7.         "What's the combination?", p,
  8.         checkbox_group(-name=>'words',
  9.                        -values=>['eenie','meenie','minie','moe'],
  10.                        -defaults=>['eenie','minie']), p,
  11.         "What's your favorite color? ",
  12.         popup_menu(-name=>'color',
  13.                    -values=>['red','green','blue','chartreuse']),p,
  14.         submit,
  15.         end_form,
  16.         hr;
  17.  
  18.    if (param()) {
  19.        my $name      = param('name');
  20.        my $keywords  = join ', ',param('words');
  21.        my $color     = param('color');
  22.        print "Your name is",em(escapeHTML($name)),p,
  23.              "The keywords are: ",em(escapeHTML($keywords)),p,
  24.              "Your favorite color is ",em(escapeHTML($color)),
  25.              hr;
  26.    }
  27.  
  28.    print end_html;


Thanking you in advance
Would you like to answer this question?
Sign up for a free account, or Login (if you're already a member).
rajiv07's Avatar
rajiv07
Familiar Sight
141 Posts
July 3rd, 2008
02:32 PM
#2

Re: CGI Script
Your script should be inside the cgi-bin directory which is a special directory to run the perl script.

Regards
Rajiv

Reply
eWish's Avatar
eWish
Moderator
660 Posts
July 3rd, 2008
04:18 PM
#3

Re: CGI Script
Sounds like the server is not setup correctly. Check to make sure that you have enable it to run CGI scripts.

--Kevin

Reply
jain236's Avatar
jain236
Member
34 Posts
July 4th, 2008
07:22 AM
#4

Re: CGI Script
Quote:
Originally Posted by eWish
Sounds like the server is not setup correctly. Check to make sure that you have enable it to run CGI scripts.

--Kevin


Exactly..kevin.. i have made the changes.. thannx for you help

Reply
Reply
Not the answer you were looking for? Post your question . . .
180,430 Experts ready to help you find a solution.
Sign up for a free account, or Login (if you're already a member).

Top Perl Forum Contributors