How to run the cgi program and what are the pre requests for the same.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bsr
    New Member
    • Mar 2007
    • 20

    How to run the cgi program and what are the pre requests for the same.

    Hi All,


    I would like to know how to run the cgi program,so what are the pre requests for the same. Please furnish the steps right from the begining.

    Here is sample perl cgi code.

    Code:
    #!/usr/local/bin/perl
    
    # hello.pl -- my first perl script!
    
    print "Content-type: text/html\n\n";
    
    print <<"EOF";
    <HTML>
    
    <HEAD>
    <TITLE>Hello, world!</TITLE>
    </HEAD>
    
    <BODY>
    <H1>Hello, world!</H1>
    </BODY>
    
    </HTML>
    EOF

    Regards,
    Bhuvan
    Last edited by miller; Apr 3 '07, 05:26 AM. Reason: Code tag
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    your code looks OK. To run perl scripts as CGI scripts:

    you need an http server, such as apache
    the server needs to be configured to run cgi scripts
    the server needs to be running
    you need a web browser such as Mozilla or IE
    obviously you need perl and an operating system

    Comment

    • Bsr
      New Member
      • Mar 2007
      • 20

      #3
      Hi Kevin,

      Thanks

      I had written perl code,saved as .cgi file and ran that file in Web Browser(IE). But its not going to be run,even it's not showing any error.

      Kindly help me.It's urgent for me.

      Regards,
      Bhuvan.

      Comment

      • KevinADC
        Recognized Expert Specialist
        • Jan 2007
        • 4092

        #4
        Provide more information.

        Is this a local server on your computer or a remote server? Is it a nix server or windows server?

        Comment

        • Bsr
          New Member
          • Mar 2007
          • 20

          #5
          Hi,

          1.Server is local server with Windows.

          2.In which folder i need to store this .cgi file

          Comment

          • KevinADC
            Recognized Expert Specialist
            • Jan 2007
            • 4092

            #6
            Normally cgi scripts would go in a cgi-bin folder that is in the root www folder. I don't know what the root www folder is for your sever, but "htdocs" is often used to designate the root www folder.

            Comment

            • Bsr
              New Member
              • Mar 2007
              • 20

              #7
              Hi,


              I do not have cgi-bin folder.How to set that folder.Please help me .


              Regards,
              Bhuvan

              Comment

              • KevinADC
                Recognized Expert Specialist
                • Jan 2007
                • 4092

                #8
                Originally posted by Bsr
                Hi,


                I do not have cgi-bin folder.How to set that folder.Please help me .


                Regards,
                Bhuvan

                This is not a perl question, it's a question concerning the http server software you are using. Ask in the appropriate forum how to configure the server you are using or search on google for tutorials that cover the particular server you are using.

                Comment

                Working...