Nov
28

PHP Fatal error: Allowed memory size of xxx bytes exhausted

PHP          Trackback

Familiar with this error code? I was working on some PHP code that is doing bunch of data analysis and I got that error. There is one line of code that can help you to fix this problem. Just put this line at the top of the script:

ini_set('memory_limit', '16M');


This will set memory limit to 16MB. If this is not helping, try to increase memory limit even more.
If you have access to php.ini and you would like to increase memory limit for all your scripts you could add this line to the server’s php.ini file:

memory_limit = 16M

If you see this message when you are running your script that is frequently executed, I would recommend you to check your code first, because most common case when you are going to see this message is whan your code is poorly written and is needlessly eating too much memory.


No Comments

Make A Comment

No comments yet.

Comments RSS Feed    TrackBack URL

Leave a comment

top