I have the following quite simple test PHP code that extracts the data and puts it into JSON formatted text.
I get the following error..
Fatal err
As a first work-around set it to something like 256M or even 512M.
It is probable the dataset that MySQL is returning to you is quite big. So even if your PHP is very memory-efficient, you still will get the OoM error. So as a more viable long-term solution use the LIMIT
statement (SELECT * FROM $table WHERE 1=1 LIMIT 0,30
(start from index 0, get 30 items).
EDIT: Oh wow, I didn't even see the problem from the first solution... Well, still might be a good idea to LIMIT
your query :-)