FastCGI и Apache и C ++ - PullRequest
       22

FastCGI и Apache и C ++

1 голос
/ 13 января 2012

Я скомпилировал проект C ++ для FastCGI, скопировал исполняемый файл в каталог 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;
}

1 Ответ

2 голосов
/ 13 января 2012

Когда вы находитесь в цикле FCGI_Accept (), вы должны читать данные, а не записывать их.

Проверить http://www.fastcgi.com/devkit/doc/fastcgi-prog-guide/apaman.htm

...