By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,852 Members | 2,220 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,852 IT Pros & Developers. It's quick & easy.

CGI Script

P: 36
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

Expand|Select|Wrap|Line Numbers
  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;
  29.  
Thanking you in advance
Jul 3 '08 #1
Share this Question
Share on Google+
3 Replies


rajiv07
100+
P: 141
Your script should be inside the cgi-bin directory which is a special directory to run the perl script.

Regards
Rajiv
Jul 3 '08 #2

eWish
Expert 100+
P: 971
Sounds like the server is not setup correctly. Check to make sure that you have enable it to run CGI scripts.

--Kevin
Jul 3 '08 #3

P: 36
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
Jul 4 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.