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

I've stored a perl script in my cgi-bin directory, the permissions of which have been set to execute scripts. I have a html file in another directory which is not enabled to execute scripts. When I click a submit button on the html webpage the perl script should execute but instead it is opened for editing.

Is this because the directory the html file is in does not have execute permission? Or some other reason?

Replies are listed 'Best First'.
Re: Calling perl scripts from html files
by RatArsed (Monk) on Aug 01, 2001 at 14:49 UTC
    Without sample code or a URL, it's hard to say, but check with your configuration that the file association is set up to run as a Perl script (on Win32 systems) or that you're treating the file association as a cgi-script with the "AddHandler" directive (on Apache systems)

    Those are most likely your problems, but there are so many things it could be, and it's hard to narrow down the options with the information given.

    If this doesn't solve your problem, make sure you include information as to what you've tried, and perhaps an offending URL?

    --
    RatArsed

Re: Calling perl scripts from html files
by busunsl (Vicar) on Aug 01, 2001 at 14:55 UTC
    In addition to what RatArsed said, this is worth reading for everyone having cgi problems.
Quick things to check.
by Agermain (Scribe) on Aug 01, 2001 at 17:50 UTC

    In my experience, the permissions of the calling HTML file have nothing to do with the permissions of the perl script. If it pulls it up for editing, that seems to imply that your CGI files aren't set up to execute, even if they have execute permissions. I'd recommend the following:

    Type in the filename into your browser. I.e. something like http://www.myserver.com/cgi-bin/myfile.cgi . If you load that page, and it still pulls the file up for editing (as I'm imagining) then the problem is NOT in the HTML file, but in the CGI file.

    If this is the case, I recommend the following:

    * If you're running ActiveState's ActivePerl, then it should (usually) assign .pl for your perl file extension. Rename the .cgi file to a .pl file and see if that works.

    * Double check your execute permissions. In IIS, there are two or three places to check these, most of which are in the Internet Services Manager. You have to click on your website, and you may need to create a 'default application'. (right click on the website name in IIS' manager app, it's somewhere at the bottom of one of the Properties pannels) I don't know why, but if you don't create an 'application' for the executables to run in, it won't always work. The second, is to right-click on the Directory properties in IIS' manager, and make sure that the Execute bit is enabled for that directory. The third, of course, is to make sure NT's filesystem (NT Explorer) allows read AND execute access. * If you're running a *IX system, your file permissions should be set to 755 or 777 (777 only if your cgi is supposed to write a file) and you should have the line #!/usr/bin/perl at the beginning - or an equivalent pathname to your perl interpreter.

    andre germain
    "Wherever you go, there you are."

Re: Calling perl scripts from html files
by thatguy (Parson) on Aug 01, 2001 at 18:13 UTC
    I may be assuming that all IIS's are alike but here is a FAQ on IIS and perl. (found it by looking here)