Archive

Posts Tagged ‘tricks’

Increasing allocated memory in PHP

May 15, 2009 Leave a comment

You can have three ways:
1. Changing memory_limit globally from php.ini
For ex: memory_limit = 32M
This change is global and will be used by all php scripts running on the system.
2. Changing memory_limit using .htaccess for a single folder/vhost
To do this you have to add to the respective location .htaccess something like: php_value memory_limit 64M
3. This one is my favorite
ini_set(‘memory_limit’, ’64M’);
The advantage of this method is that you have more control and set this value just where you know it is really needed. Also it can be done without having access to the system php.ini, and will become active immediately.

Advertisements
Categories: General Tags: ,