【问题标题】:Apache Perl 500 “Internal Server Error” - malformed header from script. Bad header=<!DOCTYPE html>Apache Perl 500 “内部服务器错误” - 来自脚本的格式错误的标头。错误的标头=<!DOCTYPE html>
【发布时间】:2022-07-05 23:32:50
【问题描述】:
Apache 500 Internal Server Error 即使在安装 Perl 并从终端 (perl hello.pl) 运行文件后一切正常。
Perl Mod 使用 Apache 设置一切都已正确配置(chmod 文件等)。
#!/usr/bin/perl
print("Hello, World!\n");
我仍然收到500 server error。
在下面修复(发布此内容以帮助其他人)。
【问题讨论】:
标签:
php
apache
perl
cgi-bin
【解决方案1】:
我检查了 apache_error.log 并看到了
malformed header from script. Bad header=<!DOCTYPE html>
您需要在文件中添加Content-type Header。
修复
#!/usr/bin/perl
print "Content-type: text/html\n\n";
print("Hello, World!\n");