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

Hey all, you may or may not been aware that to my recent problems i got recommend to reinstall perl ActiveState. Since i couldn't do that (due to old programs which need to keep running for the company), i installed portable Strawberry Perl 5.26.1.1 64bit on Windows Server 2008 R2. My knowledge about Server matters is restricted, but following issues came up:

1) I opened up an own application pool on the IIS-Manager for strawberry perl applications. Always when a module is not known or when trying to set a path a library (see code), it totally crashes and close down the pool with the msg:  HTTP Error 503. The service is unavailable. Any idea why and how to prevent that?

2)Furthermore there is a proxy installed. So when using LWP-requests, i can not get content of https pages. The following code receives the following error msgs, which is strange since the demanded module is installed!

LWP will support https URLs if the LWP::Protocol::https module is inst +alled.
Update: /running the script via windows shell:
can't connect to moz.com:443, the given host is not known at D:/Straw +berry_Perl/perl/vendor/lib/LWP/Pr otocol/http.pm line 46.
Code:
#!d:\Strawberry_Perl\perl\bin\perl.exe use strict; use warnings; use LWP::Protocol; use LWP::UserAgent; use Mozilla::CA; use CGI qw(:standard); use CGI::Carp 'fatalsToBrowser'; #use lib 'd:\\Strawberry_Perl\\perl\\vendor\\lib\\LWP\\Protocol\\'; #a +nother attempt which failed #use https; my $q= new CGI; print $q->header; my $B = new LWP::UserAgent (keep_alive => 1, agent => 'Mozilla/5.0', c +ookie_jar =>{}); my $proxy = 'http://localhost:5800'; my $Skript = "http:\/\/$ENV{SERVER_NAME}$ENV{SCRIPT_NAME}"; my $Server = "http:\/\/$ENV{SERVER_NAME}"; $B->proxy('http', $proxy); $ENV{HTTPS_PROXY} = $proxy; $ENV{'PERL_LWP_SSL_CA_PATH'} = "D:\\cert\\input\\certs"; $B->ssl_opts( SSL_ca_file => Mozilla::CA::SSL_ca_file() ); $B->ssl_opts( verify_hostname => 0 ); my $GET = $B->get('https://moz.com')->content; print $GET;
Did I install Strawberry Perl right? I downloaded the portable version, transfered to the server, unpacked it, executed the bash file and then just set the path to the perl file ("hello world" script works)

Replies are listed 'Best First'.
Re: Server Issues and https-Requests
by marto (Cardinal) on Oct 23, 2017 at 12:10 UTC

    Have you:

    • Added CGI from 'Add features and roles Wizard'? ('Server Manager'->'Manage'->'Add roles and features' then 'Server Roles'->'Web Server (IIS)'->'Web Server'->'Application Developemt')
    • Setup *.pl via 'Add script map' under 'Handler mappings' and set the executable path?
    • What is the setting 'Impersonate user' under 'CGI' within the website config?
      1) I think so 2) definitly 3) what you mean by impersonate user? my web config looks that way :
      <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <directoryBrowse enabled="true" /> <defaultDocument enabled="true"> <files> <clear /> <add value="index.html" /> </files> </defaultDocument> <httpErrors errorMode="Detailed" /> <asp scriptErrorSentToBrowser="true" /> <handlers accessPolicy="Read, Execute, Script"> <add name="Perl" path="*.pl" verb="*" modules="CgiModule" +scriptProcessor="D:\Strawberry_Perl\perl\bin\perl.exe &quot;%s&quot; +%s" resourceType="Unspecified" /> </handlers> </system.webServer> <system.web> <customErrors defaultRedirect="http://mypage.com:9900/inc3/" m +ode="On" /> </system.web> </configuration>

        "I think so"

        Since you've been asked the question, find out the answer :)

        "what you mean by impersonate user?"

        As above, ensure you're looking at the 'website' settings, under the IIS section (starting 'ASP', 'authentication' ...) you'll see 'CGI'. That's where to find impersonate user. What do the IIS log files say caused the 500 error?