PHPology is a collective of highly skilled, award winning, web gurus.
Contact Raj on 07985 467 213 or email [email protected]

How to increase memory limit with PHP

On rare occasion, I need to up the memory allowed for PHP.

This situation hit me when I was generating a large CSV file which was then forced to download.

There's an easy way to increase the amount of memory you want to allocate PHP which is something as below:

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

The above code will increase the maximum amount of memory available to PHP to 256MB.

The setting is only adjusted for the running script.