Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

libpq for hpws apache32 thread safe?

Stefan Beelen
Occasional Contributor

libpq for hpws apache32 thread safe?

We installed on HPUX 11.23 IPF machines following software:
HPWS Apache32 B.2.0.52.00
ixPostgresql A.03.00-7.4.2.001

The 'configure' options explained in the README.hp of the postgresql product indicates that the program was compiled without the --enable-thread-safety.
This means that the resulting libpq library is not thread safe. Yet it is used by the Apache32 PHP module when interfacing to a postgres database. But this apache is using
threads. Am I missing something here, or
did the HPUX engineers porting the postgresql
forget to think of these thread issues?

We do have a problem with this combination of
software products.
Sometimes PHP webpage accessing the database with pg_connect() and pg_query() fails with
following error:
Warning: pg_exec(): Query failed: could not receive data from server: Invalid argument

After refreshing the webpage (in the browser) several times, eventually we get a valid output. It appears to depend on the size of the result of the database request.
1 REPLY
Stefan Beelen
Occasional Contributor

Re: libpq for hpws apache32 thread safe?

We found a workaround for our problem.
Instead of using the synchronous pg_exec() (or pg_query()) we now use the asynchronous calls:

$conn = pg_connect(".....");
pg_send_query($conn, "SELECT ....");
while (pg_connection_busy($conn))
{
usleep(100000);
}
$res = pg_get_result($conn);


This seems to work in all tested cases.