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

Hi, I can run my perl script with perl script.pl in my cgi-bin folder, but can't execute it with ./script.pl. The shebang is #!/usr/bin/perl. I can run it in the /usr/bin/ folder with ./script.pl. What is going on? Thanks, Jo

Replies are listed 'Best First'.
Re: bin folder
by socketdave (Curate) on Sep 09, 2005 at 18:55 UTC
    Is this related to your previous node? Since you've found that scripts will execute directly in certain directories, you should see if your cgi-bin directory is on a partition that is listed as noexec in /etc/fstab.

    Is there any output from the command? Are there error messages? Please check out   'How (Not) To Ask A Question'
Re: bin folder
by InfiniteSilence (Curate) on Sep 09, 2005 at 17:45 UTC
    If you are using Apache on Windows you may have to change your shebang line to the exact location of your perl executable, i.e. #!c:\perl\bin\perl.exe.

    Celebrate Intellectual Diversity

Re: bin folder
by Fletch (Bishop) on Sep 09, 2005 at 18:03 UTC

    If the source has ever graced a Wintendo box with its presence check that there's not a lingering carriage return (\cM) on the end of the shebang line.

Re: bin folder
by InfiniteLoop (Hermit) on Sep 09, 2005 at 18:21 UTC
Re: bin folder
by kwaping (Priest) on Sep 09, 2005 at 17:41 UTC
    What are the script's permissions? Try chmod 755 /path/to/script.pl and see if that helps.
      The permissions are set to 755.
Re: bin folder
by Anonymous Monk on Sep 10, 2005 at 07:33 UTC