how to run cgi scripts?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • poolboi
    New Member
    • Jan 2008
    • 170

    how to run cgi scripts?

    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

    [CODE=perl]
    #!/usr/local/bin/perl -w
    use CGI; # load CGI routines
    $q = new CGI; # create new CGI object
    print $q->header, # create the HTTP header
    $q->start_html('he llo world'), # start the HTML
    $q->h1('hello world'), # level 1 header
    $q->end_html; # end the HTML
    [/CODE]

    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
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    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.

    Comment

    • poolboi
      New Member
      • Jan 2008
      • 170

      #3
      Originally posted by KevinADC
      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 :)

      Comment

      • numberwhun
        Recognized Expert Moderator Specialist
        • May 2007
        • 3467

        #4
        Originally posted by poolboi
        alright
        thanks for the help :)
        For the apache configuration, you can check out this link.

        Regards,

        Jeff

        Comment

        Working...