ID: 25472
User updated by: chris dot neale at somerfield dot co dot uk
Reported By: chris dot neale at somerfield dot co dot uk
-Status: Feedback
+Status: Open
Bug Type: ODBC related
Operating System: Winnt SP6a Build 1381
PHP Version: 5CVS-2003-09-10 (dev)
New Comment:

Each row contains

2 x Integers
1 x 255-Character Text value
11 x Doubles


Previous Comments:
------------------------------------------------------------------------

[2003-09-10 20:33:25] [email]sniperphp.net[/email]

Approximately HOW much data is in one row in your query..?


------------------------------------------------------------------------

[2003-09-10 12:27:51] chris dot neale at somerfield dot co dot uk

Description:
------------
I am trying to generate 700 static HTML pages each containing a table
of data. The loop appends the SQL string with the loop value and then
calls ODBC_DO. I've taken out all the table formatting routines out of
the code below, but it still tes the same fault.

ODBC connects to an Access 97 SR1 database. I have installed the Jet SP
7_9NT service pack too.

When I run it, PHP.exe shows up in task manager's process monitor,
eating away at memory fast - about 1 meg every second gets consumed by
php's process and it generates about 7000 page faults every second too.
But the script still works, and the information comes out as expected.
The memory is then freed when PHP exits.

I'm concerned this bug will cause problems when I scale the project up
to generate 20000 + reports.

I've run this code not only from a web page, but also from the command
line with some additional code which waits for a user keystroke before
continuing to the next loop iteration, hoping to slow down the process.
The same problem occurred.

I'm using the latest Win32 CVS snapshot at the time of writing.

Same problem when using latest stable build of PHP 4.

php.ini - memory_limit = 8M

I've seen the memory climb as high as 40mb when running this script.

PHP.ini modifications:

extension=php_gd2.dll enabled.
doc_root, extension_dir

That's about all the info I can find... Really hope someone can shed
some light on this one as I've been trying to solve it for about 2
weeks! Many thanks,

Chris

Reproduce code:
---------------
$dbCon = odbc_connect('AccessDbSystemDSN', '', '');

for ($nval=1;$nval<=700;$nval++)
{
$query = "SELECT * from [tablename] where ID = ".$nval;
$results = odbc_do($dbCon, $query);
}

odbc_close($dbCon);



Expected result:
----------------
I expected the memory to remain fairly constant throughout execution,
but it keeps on rising and not always at a constant rate.



Actual result:
--------------
The reports generates successfully on my desktop machine despite the
memory rising, however PHP crashes when I run it on my laptop which has
less RAM than my desktop.

Same NT build and PHP CVS snapshot on Laptop. No error message, just
'Internal Server Error' message. No Apache error log generated.


------------------------------------------------------------------------


--
Edit this bug report at [url]http://bugs.php.net/?id=25472&edit=1[/url]