如何忽略Windows上的Perl的家当与Apache 2? [英] How do I ignore the Perl shebang on Windows with Apache 2?

查看:267
本文介绍了如何忽略Windows上的Perl的家当与Apache 2?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经建立了一个本地Perl Web环境我的Windows机器上。我工作的应用程序最初是从Linux服务器,所以源家当特等文件看起来像这样:

I have set up a local Perl web environment on my Windows machine. The application I'm working on is originally from a Linux server, and so the shebang for source .pl files look like so:

#!/usr/bin/perl

这导致我的Windows开发机器上出现以下错误:

This causes the following error on my Windows dev machine:

(OS 2)The system cannot find the file specified.

是否有可能改变我的Apache 2的conf从而使家当是我的Windows机器上被忽略?当然,我可以在家当设置为#!C:\\ perl的\\ BIN \\ perl.exe所在,这一点是显而易见的;但问题来部署更新的文件。显然,这将是非常不方便更改每个部署此回。我使用的的ActivePerl 在Windows 7上。

Is it possible to change my Apache 2 conf so that the shebang is ignored on my Windows machine? Of course I could set the shebang to #!c:\perl\bin\perl.exe, that much is obvious; but the problem comes to deploying the updated files. Clearly it would be very inconvenient to change this back on each deploy. I am using ActivePerl on Windows 7.

我应该提到,我需要保持的家当,这样的脚本将我们的共享主机的Linux生产服务器上运行。如果我没有这个约束,我没有使用家当,明显的答案是只不使用它。

I should have mentioned that I need to keep the shebang so that the scripts will work on our shared hosting Linux production server. If I did not have this constraint and I didn't have to use the shebang, the obvious answer would be to just not use it.

推荐答案

我用#!的/ usr / bin中/ perl的在我的脚本和Windows上配置Apache,忽略shebang行。添加

I use #!/usr/bin/perl in my scripts and configure Apache on Windows to ignore the shebang line. Add

 ScriptInterpreterSource Registry-Strict

你的的httpd.conf ,并设置为在的Apache文档

下面是我所得到的,当我导出密钥:

Here is what I get when I export the key:


Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\.pl\Shell\ExecCGI\Command]
@="c:\\opt\\perl\\bin\\perl.exe"

我一直在使用这个设置与Apache和ActiveState的Perl的在我的Windows笔记本电脑和我的服务器上配备的ArchLinux的Apache和Perl分发。

I have been using this setup with Apache and ActiveState Perl on my Windows laptop and the Apache and Perl distributions that come with ArchLinux on my server.

Apache的文档(而我上面链接)状态:

The Apache docs (to which I linked above) state:

选项注册表严这在Apache 2.0的都是新做同样的事情注册表,但只使用该子项贝壳\\ ExecCGI \\ COMMAND ExecCGI 键不是常见的一种。它必须手动在Windows注册表中进行配置,因此prevents您的系统上意外的程序调用。 (重点煤矿)

The option Registry-Strict which is new in Apache 2.0 does the same thing as Registry but uses only the subkey Shell\ExecCGI\Command. The ExecCGI key is not a common one. It must be configured manually in the windows registry and hence prevents accidental program calls on your system. (emphasis mine)

这篇关于如何忽略Windows上的Perl的家当与Apache 2?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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