从 Azure Web 应用程序运行 Perl [英] Running Perl from an Azure Web App

查看:68
本文介绍了从 Azure Web 应用程序运行 Perl的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 Fast CGI 从 Azure Web 应用程序运行 Perl.我已经设置了 PHP 并且它工作正常,但无法让 Perl 工作.为了运行 Perl,我安装了 Strawberry Perl(我尝试了 32 位和 64 位便携版本)

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)

我为 *.pl 添加了一个处理程序,如下所示

I have added a handler for *.pl as follows

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

我有一个简单的 Perl 程序 test.pl 如下

I have a simple Perl program test.pl as follows

#!/usr/bin/perl

use strict;
use warnings;

print "Hello, World!\n";

如果我输入以下命令(从 D:\home\site\wwwroot 文件夹),它会从控制台运行,所以 Perl 工作正常.

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

如果我使用http查看

If I view it using http

 http://mywebapppath/test.pl

我收到 500 错误

如果我查看日志,得到以下信息:

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?

推荐答案

我设法弄明白了,它很模糊,所以如果你有类似的问题,我希望它能帮助你.

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

Strawberry Perl(位于 bin 文件夹中,因此无法从外部运行)带有 cpan.bat 文件,您需要使用此批处理文件从 Azure 中的控制台安装 Fast Cgi 模块.

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/

第二件事是在您的网络应用程序中为 .pl 处理程序添加一个参数.

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

-MFCGI::IIS=do

这就是你需要做的.只需重新启动服务器,Perl 就可以在我的 test.pl 页面上运行了!

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

这篇关于从 Azure Web 应用程序运行 Perl的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆