我在godaddy web host上的一个名为test.cpp的文件中编写了以下代码:
#include <iostream>
using namespace std;
int main () {
cout << "Content-type:text/html\r\n\r\n";
cout << "<html>\n";
cout << "<head>\n";
cout << "<title>Hello World - First CGI Program</title>\n";
cout << "</head>\n";
cout << "<body>\n";
cout << "<h2>Hello World! This is my first CGI program</h2>\n";
cout << "</body>\n";
cout << "</html>\n";
return 0;
}
我使用“g ++ test.cpp -o a.cgi”在godaddy主机上编译test.cpp。 然后我尝试访问cgi(类型“www.XXX.com/a.cgi”),错误代码500出来了。我不知道出了什么问题。
答案 0 :(得分:0)
www.xxx.com/cgi-bin/a.cgi
a.cgi
更改为a.cpp
,然后检查是否有效