Postgres 8.1.4 + PHP, hangs when querying more than 16 records! - Mailing list pgsql-php

From babak badaei
Subject Postgres 8.1.4 + PHP, hangs when querying more than 16 records!
Date
Msg-id 20060831062558.59948.qmail@web55213.mail.re4.yahoo.com
Whole thread Raw
Responses Re: Postgres 8.1.4 + PHP, hangs when querying more than 16
List pgsql-php
OS: Fedora Core 5
PHP: PHP 5.1.4, PHP 5.1.6, and  PHP 4.4.4 (compiled with --with-pgsql and install as binaries using YUM)
Postgres 8.1.4

This scripts works:
---------------------------------------------------------------------------------
<?php
// Connecting, selecting database
$dbconn = pg_connect("host=localhost dbname=database user=web")
   or die('Could not connect: ' . pg_last_error());

// Performing SQL query
$query = 'SELECT * FROM foobar limit 16';

$result = pg_query($query) or die('Query failed: ' . pg_last_error());


// Printing results in HTML
echo "<table>\n";
while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
   echo "\t<tr>\n";
   foreach ($line as $col_value) {
       echo "\t\t<td>$col_value</td>\n";
   }
   echo "\t</tr>\n";
}
echo "</table>\n";

// Free resultset
pg_free_result($result);

// Closing connection
pg_close($dbconn);
?>
---------------------------------------------------------------------------------
This script hangs:

-----------------------------------------------------------------------------------
 <?php
 // Connecting, selecting database
 $dbconn = pg_connect("host=localhost dbname=database user=web")
    or die('Could not connect: ' . pg_last_error());

 // Performing SQL query
 $query = 'SELECT * FROM foobar limit 17';

 $result = pg_query($query) or die('Query failed: ' . pg_last_error());


 // Printing results in HTML
 echo "<table>\n";
 while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {
    echo "\t<tr>\n";
    foreach ($line as $col_value) {
        echo "\t\t<td>$col_value</td>\n";
    }
    echo "\t</tr>\n";
 }
 echo "</table>\n";

 // Free resultset
 pg_free_result($result);

 // Closing connection
 pg_close($dbconn);
 ?>
-------------------------------------------------------------------------------------



The only difference is that in the first we limit to 16 records, in the latter, to 17 (and greater hangs as well). I
triedwith three different versions of PHP, as mentioned above (PHP 5.1.4, 5.1.6, & 4.4.4) from both Apache and from the
commandline. Attempted few times each when compiled versions and binary distributions via yum. All behave the same way.
Allhang above 17 records. 

Take care! Babak.





pgsql-php by date:

Previous
From: Andy Shellam
Date:
Subject: Re: DB Error: connect failed
Next
From: Chris
Date:
Subject: Re: Postgres 8.1.4 + PHP, hangs when querying more than 16