2012-06-23 73 views
1

我希望有人可以幫助我使用這個HelloWorld CGI C++程序。 我在本地主機上運行Xamp服務器,並將此代碼編譯到/ xamp中的cgi-bin文件夾中。 文件名是_1.exe腳本標題提前結束:C++ cgi

#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

明白了。 _1.exe存在權限問題。

相關問題