fastcgipp-users
[Top][All Lists]
Advanced

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

[Fastcgipp-users] fastcgi++ and SOCI


From: Jean-Christophe Roux
Subject: [Fastcgipp-users] fastcgi++ and SOCI
Date: Wed, 13 May 2009 07:48:59 -0700 (PDT)

Hello,

The following program compiles fine but the Apache webserver 2.2 generates the following errors:
[Wed May 13 10:41:03 2009] [error] [client 99.238.132.190] FastCGI: comm with (dynamic) server "/xxxxxxx/build/dodo.cgi" aborted: (first read) idle timeout (30 sec)
[Wed May 13 10:41:03 2009] [error] [client 99.238.132.190] FastCGI: incomplete headers (0 bytes) received from server "/xxxxx/build/dodo.cgi"

I don't understand why. I am adding the Makefile. Note that fastcgi++ and SOCI work fine separately. This a Centos 5.3 box.

Thanks for any help

    1 #include <boost/date_time/posix_time/posix_time.hpp>
      2 #include "boost/date_time/gregorian/gregorian.hpp"
      3 #include <boost/lexical_cast.hpp>
      4 #include <fstream>
      5 #include <fastcgi++/request.hpp>
      6 #include <fastcgi++/manager.hpp>
      7
      8 #include <soci.h>
      9 #include <soci-postgresql.h>
     10
     11 /////////////////////////////////////////////////////////////////////////////////////////////////////
     12 void error_log(const char* msg)
     13 {
     14   using namespace std;
     15   using namespace boost;
     16   static ofstream error;
     17   if(!error.is_open())
     18   {
     19     error.open("/tmp/errlog", ios_base::out | ios_base::app);
     20     error.imbue(locale(error.getloc(), new posix_time::time_facet()));
     21   }
     22   error << '[' << boost::posix_time::second_clock::local_time() << "] " << msg << endl;
     23 }
     24
     25 class Main : public Fastcgipp::Request<char>
     26 {
     27 public:
     28   Main()
     29   {
     30   }
     31   virtual ~Main()
     32   {
     33   }
     34   bool response()
     35   {
     36     out << "Content-Type: text/html; charset=utf-8\r\n\r\n";
     37
     38     using namespace soci;
     39     int count(0);
     40     session sql(postgresql, "dbname=toff_db");
     41     sql << "select count(*) from apps", into(count);
     42     out << count << " rows.";
     43
     44     return true;
     45   }
     46 };
     47
     48 int main()
     49 {
     50   try
     51   {
     52     Fastcgipp::Manager<Main> fcgi;
     53     fcgi.handler();
     54   }
     55   catch(std::exception& e)
     56   {
     57     error_log(e.what());
     58   }
     59 }
     60



      2 CPP = g++
      3 CPP_FLAG = -Wall -W -O3
      4 TARGET_APP = "a.out"
      5
      6 BOOST = -I "/usr/local/include/boost-1_39/"
      7 SOCI = -I "/usr/local/include/soci/"
      8 PSQL = -I "/usr/local/pgsql/include/"
      9
     10 BOOST_THREAD_LIB = "/usr/local/lib/libboost_thread-gcc41-mt.so"
     11 FASTCGI_LIB = "/usr/local/lib/libfastcgipp.so"
     12 SOCI_LIB = "/usr/local/lib/libsoci_core.so"
     13 SOCI_DL_LIB = "/usr/lib/libdl.so"
     14 SOCI_PSQL_LIB = "/usr/local/lib/libsoci_postgresql.so"
     15 PSQL_LIB = "/usr/local/pgsql/lib/libpq.so"
     16
     17 $(TARGET_APP) : main.o
     18  $(CPP) -o $(TARGET_APP) $(FASTCGI_LIB) $(BOOST_THREAD_LIB) $(SOCI_LIB) $(SOCI_DL_LIB) $(SOCI_PSQL_LIB) $(PSQL_LIB)  main.o
     19  #$(CPP) -o $(TARGET_APP) $(FASTCGI_LIB) $(BOOST_THREAD_LIB) main.o
     20
     21 main.o : main.cpp
     22  $(CPP) $(CPP_FLAG) $(BOOST) $(SOCI) $(PSQL) -c main.cpp
     23
     24 .PHONY : clean
     25 clean :
     26  rm $(TARGET_APP) *.o
     27




reply via email to

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