开发者

Allowed memory size of 67108864 bytes exhausted (tried to allocate 4459414 bytes) in writing an xml file [duplicate]

This question already has answers here: Closed 11 years ago.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜