Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

php

xml

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 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?

like image 848
karto Avatar asked Dec 05 '22 22:12

karto


1 Answers

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.

like image 146
Wh1T3h4Ck5 Avatar answered Dec 10 '22 11:12

Wh1T3h4Ck5