gpt4 book ai didi

c++ - 脚本头过早结束 : C++ cgi

转载 作者:太空宇宙 更新时间:2023-11-04 12:07:55 24 4
gpt4 key购买 nike

我希望有人能帮助我完成这个 HelloWorld CGI C++ 程序。我在本地主机上运行一个 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

最佳答案

明白了。 _1.exe 存在权限问题。

关于c++ - 脚本头过早结束 : C++ cgi,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11168828/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com