1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

CGI Scripts with *.cgi Extension Not Recognized by Plesk 7 by Default?

Discussion in 'Plesk for Windows - 8.x and Older' started by perryv, Aug 10, 2004.

  1. perryv

    perryv Guest

    0
     
    Fresh from installation, I configured Plesk 7 so that Web users can run their own CGI scripts on the server. In addition, I also enabled Perl. When I tried to create a test CGI script with a *.cgi extension (i.e., test.cgi) and upload it to a test Web User's cgi-bin directory on the Plesk server, the script won't run. I checked if there is Execute access on that user's directory, and I found out that indeed it has. Yet my script won't run. But when i renamed the script into "test.pl" (the extension is now *.pl), the test script ran successfully! I tried to add *.cgi as a text/plain content type in MIME Types, but still my *.cgi script version won't run. How should I configure Plesk 7 so that it can also run *.cgi scripts?
     
  2. chuck.boyer

    chuck.boyer Guest

    0
     
  3. perryv

    perryv Guest

    0
     
    I think it has nothing to do with the Perl installed by Plesk 7. Plesk installed ActivePerl 5.8.1 on my system. I think it has something to do with the IIS configuration which the installer apparently forgot to configure for *.cgi script support.
     
  4. shwonder

    shwonder Guest

    0
     
    1. Start IIS manager console.
    2. expand Web Sites item in tree view
    3. Select web site which you want to associate cgi extension with Perl, right click on it and choose Properties.
    4. Click Home Directory -> Configuration -> Mappings, select .pl extension, click on Edit button
    5. Copy text in edit box "Executable" to clipboard and click Cancel button.
    6. You are on a mapping dialog now (p.4). Click on 'Add..' button.
    7. Paste from clipboard text to editbox "Executable". Write ".cgi" without quotes in Extension text box. Click Ok button.

    Do the same on all domains which you allow Perl support. If you allow Perl for all domains, process points 1-7 on parent item "Web Sites". All new websites will inherit these settings. IIS will ask whether to apply changes on existing sites.
     
  5. jahsh420

    jahsh420 Guest

    0
     
    I have a question regarding cgi scripts. What do you place at the top of the scripts? I know on Linux machines it is something like this #!/usr/bin/perl. Is this the same? Also if customers are using mail scripts on Linux the path to sendmail was something like /usr/lib/sendmail, what do customer use on Windows cgi-based scripts? We use mailenable? Thanks in advance.
     
  6. perryv

    perryv Guest

    0
     
    In Windows, if you're using IIS, then what you put at the top of your scripts doesn't matter. But if you're using Apache in Windows, then the top of your script should be the full path and filename (minus the file extension) of your Perl interpreter. Example: If your perl.exe is located in C:\Perl\bin , then the top of your script should be:

    #!C:\Perl\bin\perl

    If your scripts are in the same drive as perl.exe, (i.e., your scripts and perl.exe are both on Drive C: ) then you can shorten the above line to

    #!\Perl\bin\perl

    You can also use forward slashes (/) instead of backslashes in the path, so the above examples can be written as

    #!C:/Perl/bin/perl

    #!/Perl/bin/perl


    Personally, I install my Perl in C:/usr/bin , so the top of my script is

    #!/usr/bin/perl

    That way, I can easily port my script to Linux and back without changing anything. :)

    As for the Windows mailer program, there's no sendmail built into Windows. People either use MS Exchange, Mail Enable, the commercial Windows port of sendmail, etc. But I think in Windows (and recommended on Linux too) you should use Net::SMTP and Net::pOP3 in your mail scripts.
     
  7. jahsh420

    jahsh420 Guest

    0
     
    Thanks for the info, this is just what we were looking for.
     
  8. jahsh420

    jahsh420 Guest

    0
     
    We did this and can get .pl and .cgi scripts to work in the cgi-bin. We have a few customers who dont want their scripts inside the cgi-bin. The weird thing is .pl files will work, but .cgi files dont. Any ideas?
     
Loading...