我试图在 Windows 7 上运行示例 Perl 脚本,并且我配置了 IIS 7 以允许 ActivePerl 运行,但我收到此错误:
HTTP Error 502.2 - Bad Gateway The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are "Hello World. ". Module CgiModule Notification ExecuteRequestHandler Handler Perl Script (PL) Error Code 0x00000000 Requested URL http://localhost:80/hello.pl Physical Path C:\inetpub\wwwroot\hello.pl Logon Method Anonymous Logon User Anonymous
and here is my Perl script:
#!/usr/bin/perl
print "Hello World.\n";
最佳答案
从任何 CGI 程序返回的第一个输出应该是标题。
尝试
#!/usr/bin/perl
print "Content-type: text/plain\n\n";
print "Hello World.\n";
关于perl - 为什么我在 IIS 上使用 Perl CGI 程序时会出现 "Bad Gateway"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2741268/