呵呵呵呵呵

萝莉有三好,柔体 轻音 易推倒。女神有三宝,干嘛 呵呵 去洗澡。宅男有三好:Dota 基友 破电脑。


Windows Server 2008 IIS7 安装 Perl 环境

Windows Server 2008 IIS7 安装 Perl 环境


Perl is a very popular scripting language which is used to develop a wide variety of tools. One of it"s well know uses is web based CGI (Common Gateway Interface) applications which allow Perl scripts to be executed from a web server. With a little configuration, you can configure IIS 7 on your Windows Server 2008 system to serve Perl scripts via CGI.
Copying the Perl Binaries

Before any IIS setup can be done, the Perl binary files must be extracted to your system. Download the ActiveState Perl distribution package (get the AS zip file and not the installer) and extract them to a folder on your server (i.e. "C:perl"). We will map IIS to use the files located in this directory.

image
Configuring IIS 7 to Run Perl Scripts

Open Internet Information Services Manager and open the Handler Mappings interface. image_thumb22

Click on the action, “Add Script Map”.

image

To allow IIS to execute Perl script files (.pl), configure the new script mapping with the following settings:

    Request path: *.pl
    Executable: C:perlbinperl.exe “%s” %s (where "C:perl" is the location where you extracted the Perl binaries)
    Name: Perl-pl

image

In the Request Restrictions dialog, set the Verbs tab to allow the following: GET,HEAD,POST.

image

Apply all changes.

When creating the new script mapping, IIS will ask you if you want to allow this script mapping to run as a CGI application. Answer "Yes" to the dialog.

image

Additionally, if Perl scripts will be deployed as CGI files (.cgi), a script mapping will need to be configured for this file type as well:

    Request path: *.cgi
    Executable: C:perlbinperl.exe “%s” %s
    Name: Perl-cgi
    Verbs: GET,HEAD,POST

Once finished apply your changes and select "Yes" when IIS prompts you to confirm running the script mapping as an application.

image

Once you have configured IIS to run both file types, they will be listed in your Handler Mappings.

image

After making the required configuration changes to IIS, run the “iisreset” command from the command prompt to ensure the changes are pushed through and active.

image_thumb30

At this point, IIS 7 should be able to successfully serve Perl scripts.
Testing Perl

At this point, your server is ready to go, but just to be sure we can confirm your Perl setup through IIS pretty easily. Create a couple of text files in the directory C:\Inetpub\wwwroot named "test.pl" and "test.cgi" both containing the following:

    #!c:perlbinperl.exe

    use strict;
    use CGI;
    my $test = new CGI;

    print $test->header(“text/html”),$test->start_html(“Perl Test”);
    print $test->h1(“Perl is working!”);
    print $test->end_html;

Finally, browse to the addresses: "http://localhost/test.pl" and "http://localhost/test.cgi" on your server and you should see a message stating that Perl is working. If the page loads successfully, Perl is now up and running on your machine.

image
Conclusion

Once you have Perl up and running on your Windows system, you can deploy or develop your own Perl CGI applications.

http://www.howtogeek.com/50479/how-to-install-perl-on-iis-7-for-windows-server-2008/?PageSpeed=noscript

更多内容:

windows下用wmic查看正在运行程序的命令行参数
CGI工作原理以及获得输入的方式
Windows下CGI程序取得的所有环境变量(系统和CGI环境变量)
windows 父进程 子进程 环境变量概念及示例程序源码
CGI环境变量列表及示例

本文链接地址:http://www.hehehehehe.cn/i/712.html