3

I have been looking at a few posts on this topic, but I'm still confused. Strawberry Perl and IIS 8 are installed on our Windows 2012 R2 server. I know to add a Strawberry Perl.exe under ISAPI and CGI Restrictions, and finally corrected my mistake (earlier edit of this post) of listing a DL). You can use a .exe, not just a DLL, so I have provided the path to Strawberry Perl's perl.exe. IIS 8 Menu

Edit 2/26/2019: As requested, here is the first part of Select.pl, which is listed in default documents:

#!/usr/local/bin/perl -w
# Permit/Web/Select.pl
# -*- tab-width: 8 -*-

use strict;
use warnings;
use lib qw( ../../include ./include );
use DbArgs;
use DBI;

######################################################################
# Prototypes
#
sub main();
sub HTMLPermitTypeRow($);
sub HTMLPermitClassRow($);
sub jsQuote($);

######################################################################
# Globals
#
my $HTML_ROOT_DIRECTORY     = DbArgs::HTMLRootDirectory();
my $debugging               = 0;

# start with Sunday to align with localtime order 0 to 6
#
my @weekdays                 = qw(Sunday Monday Tuesday Wednesday Thursday Friday Saturday);

# work Mon-Fri no holidays
#
my @previousworkdays        = qw(Friday Friday Yesterday Yesterday Yesterday Yesterday Friday);

my %input;

main();
exit(0);

######################################################################
#   main
#
sub main() {
    my $header;
    my $footer;
    my $inspectorsrow;
    my $today;
    my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst )= localtime( );
    my $inspected = $previousworkdays[$wday];

    %input  = DbArgs::ParseArgs();

    print "Content-type: text/html\n\n";

    # define required input
    # not defining optional input inspected, permittype, permitclass, reportformat
    #
    foreach ( qw( address contractor description inspector issue issue_thru owner ) ) {
        $input{$_} = '' unless defined $input{$_};
    }

    my $hiddenfields = '';
    foreach my $fieldname ( sort keys %input ) {
        my %definedFields = ( 'address'     => ''
                    , 'contractor'  => ''
                    , 'description' => ''

There is a permits pool, which logs in as Administrator, and the permits application uses the permits pool.

I have Select.pl listed as a default document, and the cgi handler is loaded.

When I try to reach http://locahost/permits or http://locahost/permits/Select.pl, I get a 404, but cannot find anything in the logs, Event or IIS that will give me a clue of what is going wrong. Any pointers would be appreciated.

octopusgrabbus
  • 10,555
  • 15
  • 68
  • 131
  • Please add an example Perl script and what happens when you access it thru IIS. Also, I think you might need to a mimetype for Perl to IIS, and map that to the DLL. I use ActivePerl, and it automatically does something like that I think. – jimtut Feb 25 '19 at 19:24
  • @jimtut Can't post an example. I haven't gotten that far. I'm still struggling adding what IIS 8 wants to configure this `C:\Perl\bin\perl.exe "%s%" %s ` and then the necessary module that isn't there yet. – octopusgrabbus Feb 25 '19 at 20:19
  • @jimtut Added what you requested, and re-edited OP to make more sense. – octopusgrabbus Feb 26 '19 at 16:52
  • When you say " cannot find anything in the logs, Event or IIS that will give me a clue" do you mean that you cannot find a matching 404 error event in the IIS logs at all? Or you did find some entries, but it didn't seem helpful to you? If you did find them, post them just in case they are helpful to viewers. Also: is this all done in the "Default Web Site"? Or a named application? Share some details about that part of the IIS configuration. – Justin Mar 12 '19 at 23:03
  • 1
    Change "#!/usr/local/bin/perl -w" to the path of perl.exe. Did you "enable 32-bit applications" and set "handler Mappings" -> "Add a Script Map"? http://gdavidcarter.blogspot.com/2016/04/installing-perl-on-windows-2012r2-iis-85.html – Jannes Botis Mar 14 '19 at 18:40
  • @JannesBotis Please put this in as an answer, because I did none of this. I will try this as soon as possible. Thanks. – octopusgrabbus Mar 14 '19 at 21:40
  • The comments and answer will be dealt with. I'm a one man bad, and have to get some other things running first. I will update either the OP or with an answer when I try all this out. Thank you. – octopusgrabbus Mar 17 '19 at 19:19

2 Answers2

1

Can you run any html file? If so, place a simple perl script next to it and call it. print "Content-type: text/html \n\n"; print "OK";

If this works, the problem is in your script. If it does not work you probably have the wrong settings.

Check it out at http://gdavidcarter.blogspot.com/2016/04/installing-perl-on-windows-2012r2-iis-85.html as Jannes Botis has already written.

I do not have IIS and I can not check but since version 8 I probably do not need quotes in C:\Perl\bin\perl.exe %s %s (in contrast to previous versions where it is necessary)

Slawomir Dziuba
  • 1,265
  • 1
  • 6
  • 13
0

I eventually got the new web site working working based on the helpful and valuable information from the answer and comments to the OP here, as well as some of the information in this link, noted in @SlawomirDziuba's answer.

My biggest problem was choosing the correct handler, and, in order to get this running on IIS8, I needed a script map, not the CGI module. I also installed Strawberry Perl into C:\Perl, given there is no other Perl on the system anyway.

octopusgrabbus
  • 10,555
  • 15
  • 68
  • 131
  • There is also Perl with ActiveState, also has its advantages in the form of better integration with the access to the GUI and precompiled modules. It depends on what is to be used. Both environments have their pros and cons. – Slawomir Dziuba Mar 20 '19 at 20:17