Hello World in CGI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thanawala27
    New Member
    • Mar 2007
    • 68

    Hello World in CGI

    Hi,

    I came across this code..n tried using it...but was not able to run it...

    file: hello.cgi

    Code:
    #!/usr/local/bin/perl
    
    use CGI;
    $q = new CGI;
    
    print $q->header;
    
    $q->start_html('Hello World');
    $q->h1('Hello World');
    $q->end_html;
    any help is appreciated.

    thanks.
    Last edited by miller; Apr 4 '07, 09:23 PM. Reason: Code tag
  • KevinADC
    Recognized Expert Specialist
    • Jan 2007
    • 4092

    #2
    what happens when you try and run it? Do you get an error message or what?

    Make sure this line is correct for your server:

    #!/usr/local/bin/perl

    or try:

    #!/usr/bin/perl

    make sure to chmod to 755 if necessary, you can do that with your control panel if you have one, or an FTP apllication or by shelling into the server. If you are on windows there is no need to chmod.

    If you are uploading this to a remote server make sure to transfer the file in ASCII (text) mode. See your FTP applications help files for details.

    If you are trying on your local PC from a browser, you need an http server installed and configured to run CGI scripts.

    Comment

    • savanm
      New Member
      • Oct 2006
      • 85

      #3
      Hi,

      use CGI::Carp qw(warningsToBr owser fatalsToBrowser );---->include this line

      And tel What error it shows.

      Comment

      Working...