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

how to run cgi scripts?

100+
P: 170
hi guys

i'm just starting to explore cgi scripts
hm..just a basic question
how do i run a simple like below? i got it from cpan
but they didn't explain what i should do

Expand|Select|Wrap|Line Numbers
  1.    #!/usr/local/bin/perl -w
  2.    use CGI;                             # load CGI routines
  3.    $q = new CGI;                        # create new CGI object
  4.    print $q->header,                    # create the HTTP header
  5.          $q->start_html('hello world'), # start the HTML
  6.          $q->h1('hello world'),         # level 1 header
  7.          $q->end_html;                  # end the HTML
  8.  
i've got apache and i tried to put it in my cgi-bin folder in apache
and run it on my browser with http://localhost/cgi-bin/1.cgi
but didn't seem to work
am i doing it correctly? pls advise
Apr 22 '08 #1
Share this Question
Share on Google+
3 Replies


KevinADC
Expert 2.5K+
P: 4,059
apache needs to be configured to run cgi scripts. Ask in an apache forum how to do that. Once you get it configured the method you are using should work. If you are using Linux or Unix you will also have to set the cgi script to executable, on Windows you won't have to but you will have to change the shebang line if using Windows.
Apr 22 '08 #2

100+
P: 170
apache needs to be configured to run cgi scripts. Ask in an apache forum how to do that. Once you get it configured the method you are using should work. If you are using Linux or Unix you will also have to set the cgi script to executable, on Windows you won't have to but you will have to change the shebang line if using Windows.
alright
thanks for the help :)
Apr 23 '08 #3

numberwhun
Expert Mod 2.5K+
P: 3,503
alright
thanks for the help :)
For the apache configuration, you can check out this link.

Regards,

Jeff
Apr 23 '08 #4

Post your reply

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