I have memory_limit=32M in php.ini and yet I get the exhausted error messages.
I place echo memory_get_usage() in various parts of the script just to see how much memory is being used and yet the results are no way near 32M!
Near start of script echo memory_get_usage() displays 211,192
After reading mysql data: 226,000
After displaying data in tables: 243,024
So how come the 32M is being exhausted if only a max of 243K is being used by the script?
I did think it was to do with the way I read from the database. The table is about 80Mb in size and the script reads in various passes. In order save on disk access time I store the table in a heap and run the script data reading from the heap.
$query = "create temporary table $temp_table type=heap select from $table where $name = '$name'";
.
.
$query = "select from $temp_table";
while ($row = @mysql_fetch_row($result)) {
.
.
}
So I thought this was the problem but that works just fine. Besides, it would be MySql which would barf at this point due to memory errors.
Any ideas why php is failing with exhausted memory?