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

I have created a PERL script for processing a form. I have installed the PERL interpreter and configured IIE to allow scripts and executables to be executed. But whenever I click on the submit button of the form, a pop-up comes up asking the user whether he/she wants to download the PERL file. The ACTION attribute of my form looks like this: ACTION=form.pl. Does anyone have an idea of why this is happening. Forgive me if I did not provide enough information. I'm a complete PERL/CGI newbie. Thanks.

Replies are listed 'Best First'.
Re: Script executing on client, not server
by ikegami (Patriarch) on Aug 10, 2004 at 21:31 UTC

    If you save the file and look at it with your text editor, do you see your perl code or the html output?

    If it's the perl code, it sounds like the web server isn't configured to treat .pl files as CGI scripts. In addition to making sure the file has execute permissions for the web server, try renaming it to form.cgi or editing the server's configuration.

    If it's the html output, maybe your script isn't output a proper header. (Content-type and double \n at the end.)

      When I choose the PERL file and 'open with' Notepad, I see the code. When I open up the HTML file that has the form that calls the PERL, I see pure HTML. Is this what you were asking?

      I have changed the file extension to cgi. Now, instead of getting a prompt to download the file, what happens is that the browser opens up the cgi file and displays its code in the browser window. Strange....

        It's definitely a server configuration issue or a permissions problem. I can't help you there.
Re: Script executing on client, not server
by inman (Curate) on Aug 11, 2004 at 12:55 UTC
    You need to take a look at the following
    1. Create a file system directory to store your perl scripts. Make sure that read/execute permissions are granted to iusr_<server> user (assuming the script is being run anonymously).
    2. Create a virtual directory in IIS.
    3. Use the properties page to set the execute permissions to scripts and executables (Perl.exe is an executable)
    4. If necessary, add an extension map for a .pl extension using the configuration button on the directory properties page. This may already be done if you have installed the ActiveState distribution.

    If you need to add a map for.pl files then you will need the following:
    Executable: C:\Perl\bin\perl.exe "%s" %s
    Extension: .pl
    Limit to: GET,HEAD,POST
    Script Engine : yes
    Check File Exists : yes

      Thanks inman. I have two questions:

      1.What is iusr_<server> user? I realize I'm supposed to replace 'server' with my server's name. But where do I input this info? Is that under folder properties, in the security tab?

      2. How do I use this virtual directory. I've been previously told to create a virtual directory, and set the correct settings. I've done that. But what am I supposed to do with this directory? Where/how do I reference it? Any special syntax?

      Thanks

        The iusr_server user is created when IIS is installed (possibly with the installation of your OS). The user account is a local account that is used by IIS to serve content to 'anonymous' users. You can explicitly set the permissions for this user in the folder properties, security tab. The IUSR_server account will be listed in the local computer's users (as opposed to a Domain). This user needs to have read/execute access (not write).

        Check out this link - http://aspn.activestate.com/ASPN/docs/ActivePerl/faq/Windows/ActivePerl-Winfaq6.html#How_do_I_configure_Microsoft_IIS from the ActiveState website for more info on setting up ActiveState Perl with IIS.