fastcgipp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fastcgipp-users] Timeout waiting for output from CGI script


From: Jean-Christophe Roux
Subject: [Fastcgipp-users] Timeout waiting for output from CGI script
Date: Mon, 13 Apr 2009 06:07:20 -0700 (PDT)

Hello,

Great project!

I downloaded and installed without any issuer fastcgi++-2.0alpha-81f89e4e.tar.bz2  but I am struggling with my helloworld program

main.cpp is below and is a simplified version of one found in the examples.
I am running Apache 2.2 on Centos 5

compilation goes fine but when I try to access the webpage through a browser, loading the page take a while and the page is blank., I am getting the following error message as logged by Apache:
 Premature end of script headers: a.out
and 
 Timeout waiting for output from CGI script /some_path/cgi/a.out

Thanks for any help
JCR

Below are the main.cpp file and a portion of my httpd.conf file 





httpd.conf contains
<Directory some_path>
  Options +ExecCGI
  AddHandler cgi-script .cgi .jcr .out .toff
</Directory>

main.cpp
#include <boost/date_time/posix_time/posix_time.hpp>
#include <fstream>
#include <fastcgi++/request.hpp>
#include <fastcgi++/manager.hpp>

void error_log(const char* msg)
{
   using namespace std;
   using namespace boost;
   static ofstream error;
   if(!error.is_open())
   {
     error.open("/tmp/errlog", ios_base::out | ios_base::app);
     error.imbue(locale(error.getloc(), new posix_time::time_facet()));
   }
   error << '[' << posix_time::second_clock::local_time() << "] " << msg << endl;
}
class HelloWorld: public Fastcgipp::Request<wchar_t>
{
  bool response()
  {
    out << "Content-Type: text/html; charset=utf-8\r\n\r\n";
    out << "hello my friend" << "<br />";
    err << "Hello apache error log";

    return true;
  }
};

int main()
{
  try
  {
    Fastcgipp::Manager<HelloWorld> fcgi;
    fcgi.handler();
  }
  catch(std::exception& e)
  {
    error_log(e.what());
  }
}


reply via email to

[Prev in Thread] Current Thread [Next in Thread]