【问题标题】:Premature end of script headers: C++ cgi脚本头过早结束:C++ cgi
【发布时间】:2012-06-25 11:57:11
【问题描述】:

我希望有人可以帮助我完成这个 HelloWorld CGI C++ 程序。 我在 localhost 上运行 Xamp 服务器,并在 /xamp 内的 cgi-bin 文件夹中编译了这段代码。 文件名为_1.exe

#include <iostream>

using namespace std;

int main(int argc, char** argv) {
    cout <<"Content-Type: text/html\n\n";                                       

    cout << "<?xml version = \"1.0\" encoding=\"ISO-8859-1\"?>" <<endl;          
    cout <<"<!DOCTYPE html Public \"-//W3C//DTD XHTML 1.1//EN\" "<<endl;
    cout << " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">"<<endl;

    cout <<"<html xmlns = \"http://www.w3.org.1999/xhtml\lang=\"en\" xml:lang=\"en\"\">"<<endl;
    cout <<"<head><title>Helloworld</title></head>"<<endl;                          

    cout <<"<body><h1>Hello world!!</h1></body></html>";
    return 0;
}

可执行文件从 Windows 运行,但如果我从服务器调用它,我会得到:

Error message:
Premature end of script headers: _1.exe 

我正在使用 Netbeans 和 cygwin 工具进行编译。

我也尝试重命名文件_1.cgi

【问题讨论】:

    标签: c++ apache netbeans windows-7 cgi


    【解决方案1】:

    知道了。 _1.exe 存在权限问题。

    【讨论】:

      猜你喜欢
      • 2012-04-07
      • 2021-12-03
      • 2011-03-19
      • 2012-06-09
      • 2014-06-03
      • 1970-01-01
      • 2012-09-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多