Pages

Thursday, March 28, 2013

Increase PHP Memory Allowance Using ini_set()

On rare occasion, I need to up the memory allowed for PHP. Usually it's when I deal with large files and don't necessarily care about optimizing the file reading process but simply getting the file opened. There's an easy way to increase to amount of memory allowed to PHP right in your script:

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


The above code will increase the maximum amount of memory available to PHP to 16 MB. Again, the setting is only adjusted for the running script.
 
 

No comments:

Post a Comment