issue with fastcgi program


 
Thread Tools Search this Thread
Top Forums Programming issue with fastcgi program
# 1  
Old 05-18-2009
issue with fastcgi program

Hello,

I am strugglign with the following fastcgi C++ program with access to a postgresql database through the SOCI library. All the components work individually properlyy but the combination does not. The program compiles fine but the Apapche 2.2 error log files contains:

[Mon May 18 10:09:23 2009] [error] [client IP.IP.IP.IP] FastCGI: comm with (dynamic) server some_path/dodo.cgi" aborted: (first read) idle timeout (30 sec)
[Mon May 18 10:09:23 2009] [error] [client IP.IP.IP.IP] FastCGI: incomplete headers (0 bytes) received from server "some_path/dodo.cgi"

main.cpp

Code:
      1 #include <fastcgi++/request.hpp>
      2 #include <fastcgi++/manager.hpp>
      3 #include <fstream>
      4 #include <boost/date_time/posix_time/posix_time.hpp>
      5 #include <boost/date_time/gregorian/gregorian.hpp>
      6 #include <boost/lexical_cast.hpp>
      7 #include <soci.h>
      8 #include <soci-postgresql.h>
      9 #include <libpq-fe.h>
     10
     11 class Main : public Fastcgipp::Request<char>
     12 {
     13 public:
     14   Main()
     15   {
     16   }
     17   virtual ~Main()
     18   {
     19   }
     20   bool response()
     21   {
     22     out << "Content-Type: text/html; charset=utf-8\r\n\r\n";
     23
     24     int count(0);
     25     //using namespace soci;
     26     //session sql(postgresql, "dbname=toff_db");
     27     //sql << "select count(*) from apps", into(count);
     28     //out << count << " rows.";
     29
     30     return true;
     31   }
     32 };
     33
     34 int main()
     35 {
     36   try
     37   {
     38     Fastcgipp::Manager<Main> fcgi;
     39     fcgi.handler();
     40   }
     41   catch(std::exception& e)
     42   {
     43   }
     44 }

Makefile
Code:
     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
     20 main.o : main.cpp
     21  $(CPP) $(CPP_FLAG) $(BOOST) $(SOCI) $(PSQL) -c main.cpp

As you can see, the call to the postgresql database through soci has been commented out but the problem remains.

Could someone either solve the problem or maybe indicate me a way to investigate further to find a solution.

Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. Programming

File Program issue in c

B17 -> B19 ; B17 -> B21 ; B18 -> B19 ; Can any one help with the pointer solution to check for this -> symbol and one it finds the symbol it should move behind 4 characters and store the string B17 in an array and then move 4 characters ahead and similarly save B21 likewise for each line... (7 Replies)
Discussion started by: zinat
7 Replies

2. AIX

FastCGI in AIX7.1

I am trying to use fcgi lib in aix7.1 version. when i trying to refer it gives me an munch:error ..Error reading input file.. Does anyboby has fcgi lib for aix7.1...plz suggest wait for the reply soon (0 Replies)
Discussion started by: greenworld123
0 Replies

3. Homework & Coursework Questions

Fortran program issue

1. The problem statement, all variables and given/known data: I was given this program to work with that is supposed to work as it is. It comes with a makefile so all I should have to do is use the make command, then type ./blub to execute the program. A list of data should then appear in the... (3 Replies)
Discussion started by: Arjani
3 Replies

4. Solaris

Issue in pro*C program compiled in solaris 10

Hi, We upgraded our servers from solaris 9 to 10. We recompiled all the Pro*C programs with the new oracle version as well. Oracle is 11g. We are facing core dump with the below error for certain executions. But when we are placing new statements between the error fucntion we get junk values to... (1 Reply)
Discussion started by: saroopkris85
1 Replies

5. UNIX for Dummies Questions & Answers

Script to open program and send/execute command in program

Hi, i want to write a script that executes a program (exec?) . this program then requires a filename as input. how do i give it this input in the script so the program will be complete run and close by the script. e.g. exec prog.exe program then asks for filename "enter filename:"... (1 Reply)
Discussion started by: tuathan
1 Replies

6. UNIX for Advanced & Expert Users

Setuid Program with (-rwsr-sr-x 1 root other ) UID/EUID issue

Hi, I have a program with the following suid setup -rwsr-sr-x 1 root other 653 Aug 16 17:00 restart_server It basically starts up a service that has to be started by root. I just want the normal users to be able to restart the service using the script above. But when the... (7 Replies)
Discussion started by: 0ktalmagik
7 Replies
Login or Register to Ask a Question