Test if CGI is working.

How do I tell if my cgi-bin is funcioning properly?

im using apache2 on winXP

Comments

  • Hi,

    : How do I tell if my cgi-bin is funcioning properly?
    :
    : im using apache2 on winXP

    Uh...throw a script in there and see if it executes. ;-) Obviously, the server will need to know how to handle those scripts. Try putting a Perl script like this in there (you've got ActivePerl or a windows Perl distribution, right?)

    #!C:/perl/bin/perl.exe

    print "Content-type: text/html

    Hello world!

    ";


    If it's set up right, you'll see the text "Hello world!" when you point your browser at the script. If you see the script, you've got it wrong.

    Jonathan

    -------------------------------------------
    Count your downloads:
    http://www.downloadcounter.com/
    And host your site:
    http://www.incrahost.com/
    Don't say I never give you anything... ;-)

  • : Hi,
    :
    : : How do I tell if my cgi-bin is funcioning properly?
    : :
    : : im using apache2 on winXP
    :
    : Uh...throw a script in there and see if it executes. ;-) Obviously, the server will need to know how to handle those scripts. Try putting a Perl script like this in there (you've got ActivePerl or a windows Perl distribution, right?)
    :
    : #!C:/perl/bin/perl.exe
    :
    : print "Content-type: text/html

    Hello world!

    ";
    :
    :
    : If it's set up right, you'll see the text "Hello world!" when you point your browser at the script. If you see the script, you've got it wrong.
    :
    : Jonathan
    :


    I just figured it out. It's something really stupid as usuall. I had all my directives and all that apache configurations correct. Except on the first line of the perl script where your sopposed to put the directory where perl is located ' #!/usr/bin/perl ' according to the many online souces and the book I have, well I thought that, that was for unix or linux or one of crazy things, you see im on winXP and perl is located in ' C:/perl/bin ' but for some reason ' #!/usr/bin/perl ' works and the real location ' C:/perl/bin ' dosent.

    maybe you could elaborate on this...
  • Hi,

    : I just figured it out. It's something really stupid as usuall. I had all my directives and all that apache configurations correct. Except on the first line of the perl script where your sopposed to put the directory where perl is located ' #!/usr/bin/perl ' according to the many online souces and the book I have, well I thought that, that was for unix or linux or one of crazy things, you see im on winXP and perl is located in ' C:/perl/bin ' but for some reason ' #!/usr/bin/perl ' works and the real location ' C:/perl/bin ' dosent.
    :
    : maybe you could elaborate on this...

    "Elaborate" Favorite word? ;-) j/k

    Well...what to say...here's my rough and ready explanation. The shebang is a Linux/UNIX thing - under windows you are used to a file's extension determining what it is. In Linux/UNIX the first line of a script says what it should be interpreted with. Shell scripts often have #!/bin/sh on the top of them, for example. Perl scripts have the location of the Perl interpreter, #!/usr/bin/perl quite a lot of the time.

    One thing I've heard is that under Windows it doesn't matter whether or not you have a #! (sh-bang) line. You could get away without one. But why things like:-

    #!C:PerlBinPerl.exe

    Won't work, I have no idea. Two pointers:-
    1) You need to point to the Perl executable.
    2) The #! must be at the start of the line. It's not part of the path!

    #!/usr/bin/perl
    perl is the name of the perl exeutable in the folder /usr/bin (yep, no .exe extension on Linux). You'll also notice they don't have drive letters under Linux/UNIX. :-)

    Any help?

    Joanthan


    -------------------------------------------
    Count your downloads:
    http://www.downloadcounter.com/
    And host your site:
    http://www.incrahost.com/
    Don't say I never give you anything... ;-)

  • It's all clear to me now...
    ...except the there's some logging problems Ive run into, which I have posted a new message for.

    maybe you could answer that too...
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories