Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi All

I apologize as this isnt directly a perl language question, but here is my problem

I have uploaded a .cgi file in my cgi-bin, but when I run in from the command line it comes up with 'no such file or directory' this also happens when apache attempts to run i. The file was uploaded in ASCII and is set to 755, does anyone have any ideas? thank you

Replies are listed 'Best First'.
Re: Strange Problem
by derby (Abbot) on Feb 12, 2002 at 13:15 UTC
    AM,

    Well it could be a perl problem. Is it a perl script? Is it a script? If so, check the she-bang line (#!/usr/bin/perl or such) and make sure that that path is correct. I would not be suprised if perl (or which ever program your interpreter is) is in a different location.

    update:

    On the server, do a "which perl" and ensure that path matches the first line of your file.cgi. As for the warning about uninitialized variables, kudos for using -w in your script. That message will go to STDERR (show up in logs) and will not be sent to the client. As for the status line, well only you know what your script should or shouldn't be doing

    -derby

Re: Strange Problem
by tachyon (Chancellor) on Feb 12, 2002 at 13:37 UTC

    First I might suggest the CGI Help Guide. Next if you can get a command line prompt (you say you can) do a ls /path/to/your/script/cgi-bin/ Obviously you should see your script. The apache httpd.conf file maps my.domain.com/cgi-bin/ to a real directory on your server like /usr/home/your/cgi-bin/ - if this mapping is wrong your script will obviously not be found.

    The error at line 115 means you have something like:

    my $undef_variable; print "This will generate a undefined variable used in eq warning" if $undef_variable eq "Oops forgot to define this";

    The next bit "Status 302 moved...." is the headers your script is outputing. Because you have an error message before this you will get a 500 internal server error as you are not outputting a valid header (until after this error)

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      You might like to try adding the following, which I put in CGI scripts:

      <code> use CGI::carp qw(fatalsToBrowser); <code>

      This now produces sensible messages on the browser.

        I think you mis-typed that a little:

        use CGI::Carp qw(fatalsToBrowser);

        "Carp" would need to have an upper-case "C".
        --

Re: Strange Problem
by Anonymous Monk on Feb 12, 2002 at 13:13 UTC
    If I do a 'perl file.cgi' I get this:

    Use of uninitialized value in string eq at file.cgi line 115. Use of uninitialized value in string eq at file.cgi line 115. Status: 302 Moved location: http://www.domain.com/page.html