【问题标题】:FastCGI and Apache and C++FastCGI 和 Apache 和 C++
【发布时间】: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;
}

【问题讨论】:

    标签: c++ apache ubuntu fastcgi


    【解决方案1】:

    当您在 FCGI_Accept() 循环中时,您应该读取数据,而不是写入数据。

    查看http://www.fastcgi.com/devkit/doc/fastcgi-prog-guide/apaman.htm

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-11-09
      • 2010-09-23
      • 1970-01-01
      • 2016-09-02
      • 2015-02-04
      • 2015-11-22
      • 2012-05-02
      • 2014-06-18
      相关资源
      最近更新 更多