Friday, October 15, 2010

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','15M');
The above code will increase the maximum amount of memory available to PHP to 15 MB. Again, the setting is only adjusted for the running script.

No comments:

Post a Comment