Sponsored Content
Full Discussion: issue with fastcgi program
Top Forums Programming issue with fastcgi program Post 302317217 by JCR on Monday 18th of May 2009 10:25:00 AM
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
 

6 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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
oar-database(1) 						   OAR commands 						   oar-database(1)

NAME
oar-database - create/initialize/upgrade/reset/drop the oar database SYNOPSIS
oar-database --create [OPTIONS] oar-database --drop [OPTIONS] oar-database --setup [OPTIONS] oar-database --reset [OPTIONS] DESCRIPTION
Manage the oar database. --setup Initialize/Upgrade an existing database. --reset Reset an existing database. --create Create and initialize a new database/user. --drop Drop an existing database/user. OPTIONS
General parameters --conf=OAR_CONF_FILE Define the oar configuration file to use. By default /etc/oar/oar.conf is used. This file doesn't exist, the default parameters for each value are used. --update-conf The database parameters given in the command line are writen to the OAR_CONF_FILE -h,--help Display this help. -d,--debug Display more information during the script execution -f,--force-sql Force to resume the execution even if an sql instruction fails -y,--force-yes This option will cause oar-database to continue without prompting if it is doins something potentially harmful Database admin parameters These parameters are only needed for database/user creation or removing. --db-is-local For --create or --drop, this option tells that the database is local. oar-database can use local admin account to execute command (useful for postgres). --db-admin-user=DB_ADMIN_USER For --create or --drop, this option gives the privilegied user to use. --db-admin-pass=DB_ADMIN_PASS For --create or --drop, this option gives the privilegied user pass to use. SQL parameters By default, if not specified, all the sql parameters are taken from the OAR_CONF_FILE. It is preferable to set these values directly to this file. --db-type=DB_TYPE The type of the SQL database. It can be currently, mysql or Pg (for postgresql). --db-user=DB_USER Connect to the database as the user DB_USER instead of the one given in OAR_CONF_FILE. By default, if OAR_CONF_FILE doesn't specify a user, it is oar. --db-pass=DB_PASS Connect to the database with the password DB_PASS instead of the one given in OAR_CONF_FILE. --db-host=DB_HOST Connect to the database on the host DB_HOST, By default, if OAR_CONF_FILE doesn't specify a host, it is localhost. --db-port=DB_PORT Connect to the database on the port DB_PORT, By default, if OAR_CONF_FILE doesn't specify a port, the value depend on the DB_TYPE. if DB_TYPE is mysql, DB_PORT is 3306. If DB_TYPE is postgresql, DB_PORT is 5432. --db-name=DB_NAME Connect to the database on the host DB_HOST, By default, if OAR_CONF_FILE doesn't specify a database name, it is oar. --db-ro-user=DB_RO_USER same as --db-user except that it is for the read only access. --db-ro-pass=DB_RO_PASS same as --db-pass except that it is for the read only access. EXAMPLES
Mysql First you need to specify the sql parameters in /etc/oar/oar.conf. These parameters will be used by oar-database. To create a new database (assuming that the sql root password is PASS): oar-database --create --db-admin-user root --db-admin-pass PASS To upgrade an existing database: oar-database --setup Postgresql First you need to specify the sql parameters in /etc/oar/oar.conf. These parameters will be used by oar-database. Then if your postgresql database is on the local system, you can use the option --db-is-local (otherwise, the procedure is the same as Mysql). So oar-database will use the postgres unix user to administrate the database (you need privilegied access to the local system). To create a new database: oar-database --create --db-is-local To upgrade an existing database: oar-database --setup Advanced usages To make some tests or to administrate several databases, you can also specify the sql parameters on the command line. For example: oar-database --create --db-type=Pg --db-host=HOST --db-user=oar --db-pass=PASS --db-admin-user=ADMIN_USER --db-admin-pass=ADMIN_PASS will create the oar database and the oar user on the postgresql system hosted by HOST. The user ADMIN_USER must have the right to create new databases and new roles on this system. FILES
/usr/lib/oar/database/mysql_structure.sql, /usr/lib/oar/database/pg_structure.sql SQL instructions for creating the structure of the oar database. /usr/lib/oar/database/mysql_default_admission_rules.sql, /usr/lib/oar/database/pg_default_admission_rules.sql SQL instructions for inserting the default admission rules in the oar database. /usr/lib/oar/database/default_data.sql SQL instructions for inserting the default data in the oar database. /usr/lib/oar/database/mysql_reset_structure.sql, /usr/lib/oar/database/pg_reset_structure.sql SQL instruction for emptying an existing oar database. /usr/lib/oar/database/mysql_structure_upgrade_*.sql, /usr/lib/oar/database/pg_structure_upgrade_*.sql SQL instructions for upgrading an existing database. oar-database 2012-06-26 oar-database(1)
All times are GMT -4. The time now is 02:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy