"头与QUOT前脚本输出端;错误阿帕奇 [英] "End of script output before headers" error in Apache

查看:192
本文介绍了"头与QUOT前脚本输出端;错误阿帕奇的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

的Apache在Windows上给了我,当我尝试访问我的Perl脚本以下错误:

Apache on Windows gives me the following error when I try to access my Perl script:

Server error!

The server encountered an internal error and was unable to complete your request.

Error message: 
End of script output before headers: sample.pl

If you think this is a server error, please contact the webmaster.

Error 500

localhost
Apache/2.4.4 (Win32) OpenSSL/1.0.1e PHP/5.5.3

这是我的示例脚本

#!"C:\xampp\perl\bin\perl.exe"
print "Hello World";

但不工作的浏览器

but not working on browser

推荐答案

如果这是Web的CGI脚本,那么你就必须输出你的头:

If this is a CGI script for the web, then you must output your header:

#!"C:\xampp\perl\bin\perl.exe"

print "Content-Type: text/html\n\n";
print "Hello World";

以下错误消息告诉您之前头输出脚本这个结束:sample.pl

甚至更好,使用 CGI 模块输出的标题。

Or even better, use the CGI module to output the header.

#!"C:\xampp\perl\bin\perl.exe"

use strict;
use warnings;

use CGI;

print header();
print "Hello World";

这篇关于"头与QUOT前脚本输出端;错误阿帕奇的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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