Possible Duplicate:
Allowed memory size of 33554432 bytes exhausted (tried to allocate 43148176 bytes) in php
I've seen similar problems here, but mine is开发者_如何学JAVA quite different. I am reading from database and writing to an xml file. I get this error
<b>Fatal error</b>: Allowed memory size of 67108864 bytes exhausted (tried to allocate 4459414 bytes) in <b>.../public/home/..</b> on line <b>32</b><br />.
What should be the solution? Do I increase the memory size in code? Any help?
Try to increase or remove memory_limit in php.ini
.
Find something like this and change value of memory_limit
; Maximum amount of memory a script may consume (128MB)
; http://php.net/memory-limit
memory_limit = 128M
(this is part of my php.ini)
Restart server after saving changes.
Also, you can try to remove limit from code.
Example:
ini_set('memory_limit', '-1');
That should work fine.
Another way is setting memory limit from .htaccess file by adding line:
php_value memory_limit 128M
(128M is just an example)
Note: For shared hosting I highly doubt you can change memory limit.
Do a mysql_unbuffered_query()
rather than mysql_query()
. Your query is probably returning too much data as is for your php server to handle.
精彩评论