Can't execute file with .pl extension in /usr/local/apache/cgi-bin ... ?

Discussion in 'Apple' started by boris, Mar 21, 2006.

  1. boris

    boris Guest

    Hi,

    I have installed httpd 1.3.33 on Mac OS 10.4.5 and couldn't get CGI
    Perl scripts to work. I found that this is not a httpd problem, but
    some weirdness in the directory.

    When I execute a Perl script e.g. "test.pl" (print "testing"; exit;)
    with the extension .pl in the /usr/local/apache/cgi-bin directory, the
    script hangs. The very same script in a different directory runs ok.
    When I cp the script to "test" (without the extension), it executes
    normally. It appears that something is preventing the execution of
    files with the extension .pl Is this intended? Can this be changed?
    If this is a feature, what is this good for?

    Thanks for some insight.

    Boris
     
    boris, Mar 21, 2006
    #1
    1. Advertisements

  2. what does the log file say? Is it running the script? what's the
    simplest script you can run that works? I'm thinking you might have a
    httpd.conf problem, but you didn't give enough info to really say what's
    going on. Is execute permissions set on the file?
     
    Michael Vilain, Mar 21, 2006
    #2
    1. Advertisements

  3. Change the name to something else. Try "testme.pl" and retry your tests.
     
    void * clvrmnky(), Mar 21, 2006
    #3
  4. boris

    boris Guest

    Thanks - that got me on the right track: problem was: a script by the
    same name in a direc tory earlier on the $PATH was interfering. All
    works as it should. Just typing ./test.pl did the trick.

    Thanks again!

    Boris
     
    boris, Mar 22, 2006
    #4
  5. [Note: it's a good habit to quote previous conversations, as there is no
    guarantee that our messages will remain threaded together forever. I
    added a small quote for you at the top of this reply.]

    "test" is either on the path or a shell built-in. Just never name a
    test script "test" on a POSIX system!

    I'm pretty sure this is one of the main reasons for the continued use of
    meta-syntactic constructs like "foo", "baz" or "bar" for script
    basenames. I know my fingers make either "foo.xx" almost automatically
    now. Well, I make a fair amount of "testme" and "doit" scripts, as well.
     
    void * clvrmnky(), Mar 22, 2006
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.