Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Perl from an Azure Web App

Tags:

perl

azure

I am trying to run Perl from an Azure Web App using Fast CGI. I have set up PHP and it works ok, but can't get Perl working. To run Perl I have installed Strawberry Perl (I have tried both 32-bit and 64-bit, portable versions)

I have added a handler for *.pl as follows

d:\home\site\wwwroot\bin\perl\bin\perl.exe

I have a simple Perl program test.pl as follows

#!/usr/bin/perl

use strict;
use warnings;

print "Hello, World!\n";

It runs from the Console if I type the following command (from the D:\home\site\wwwroot folder) so Perl is working ok.

> bin\perl\bin\perl.exe test.pl

If I view it using http

 http://mywebapppath/test.pl

I get a 500 error

If I look at the logs at get the following:

HTTP Error 500.0 - Internal Server Error

d:\home\site\wwwroot\bin\perl\bin\perl.exe - The FastCGI process exited unexpectedly

I have run out of ideas what to try next. Any suggestions?

like image 758
Rob Sedgwick Avatar asked Oct 26 '25 08:10

Rob Sedgwick


1 Answers

I managed to figure it out and it is quite obscure so I hope it helps if you have a similar problem.

Strawberry Perl (which goes in the bin folder so it can't be run from the outside) comes with a cpan.bat file and you need to install the Fast Cgi module from a Console in Azure using this batch file.

bin\perl\bin\cpan.bat -i /FCGI::IIS/

The second thing is to add an argument for the .pl handler in your web app.

-MFCGI::IIS=do

That's all you need to do. Just restart the server and Perl works from my test.pl page!

like image 141
Rob Sedgwick Avatar answered Oct 29 '25 06:10

Rob Sedgwick