PHP memory limit is a very simple error to solve. When loading new plugin to a CMS or transferring data into a database this error may effect areas of your program:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 1841890 bytes) in /the_path/to_your/file.php

Two simple lines of code can make all the difference. If you don’t have root access or you don’t want to change your server configuration attach this code to the top of the file:

1
2
 
ini_set("memory_limit","32M");

If you want to change the memory limit for all the files on your server add this code to your php.ini file giving the error.

1
2
 
memory_limit = 32M

This should let you make the uploads and changes you need without memory hangups or annoying error messages. One thing in this age of very fast hardware and one if my bigger fears about software, is that added memory is no replacement well written code.

Leave a Reply

Your email address will not be published. Required fields are marked *