Postgres 8.1.4 + PHP, hangs when querying more than 16 records!

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



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 tried with three different versions of PHP, as mentioned above (PHP 5.1.4, 5.1.6, & 4.4.4) from both Apache and from the command line. Attempted few times each when compiled versions and binary distributions via yum. All behave the same way. All hang above 17 records.

Take care! Babak.






[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux