我有以下CGI脚本:
#!c:\cygwin\bin\perl.exe
use CGI qw(:standard);
my $query = $CGI->new;
print header (
-type => "text/html",
-status => "404 File not found"
);
print "<b>File not found</b>";
Run Code Online (Sandbox Code Playgroud)
这给了我一个错误:
Server error!
The server encountered an internal error and was unable to complete your request.
Error message:
End of script output before headers: test.cgi
If you think this is a server error, please contact the webmaster.
Error 500
127.0.0.1
Apache/2.4.10 (Win32) OpenSSL/1.0.1h PHP/5.4.31
Run Code Online (Sandbox Code Playgroud)
我已经看过这个(和其他类似的)问题,但是标题没有被print编辑,而不是我的.
我正在使用Cygwin Perl的XAMPP Windows软件包.
有人可以帮忙吗?谢谢.
我不知道你为什么使用$ CGI而不是CGI
我认为应该是
my $query = CGI->new;
Run Code Online (Sandbox Code Playgroud)
在Linux上测试工作完美.