【发布时间】:2012-02-09 13:21:00
【问题描述】:
我为 FastCGI 编译了 C++ 项目,将可执行文件复制到 www 目录,通过浏览器打开 - 得到 500 错误(超时异常)。我怎么了?
操作系统 Ubuntu 10.05,服务器:Apache
源 C++ 代码:
#include <fcgi_stdio.h> /* fcgi library; put it first*/
#include <fcgiapp.h>
#include <cstdlib>
#include <iostream>
using namespace std;
int count;
int main(int argc, char** argv) {
/* Response loop. */
while (FCGI_Accept() >= 0) {
cout<<"Content-type: text/html\r\n"
"\r\n"
"<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
"<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
"Request number %d running on host <i>%s</i>\n";
}
return 0;
}
【问题讨论】: