Increase PHP memory limit
Increase PHP memory limit
A PHP memory limit of 16MB is required for Drupal 6. Some sites may need more than 16MB if they are using many contributed modules. There are several techniques to increase the PHP memory limit and you only need to use one of them. The right one for you depends on your system configuration.
php.ini
This is the recommended approach if you have access to php.ini. This may not be possible in many shared hosting environments. Note that this change will affect all websites and PHP scripts on the server.
- Locate the php.ini file used by your web server. You can use the
phpinfo()PHP function to find it. During installation Drupal checks the PHP Memory Limit and if it is less than 16M an error message also provides the path to the php.ini file. - Edit the memory_limit parameter in the php.ini file (usually in a section called Resource Limits)
memory_limit = 16M ; Maximum amount of memory a script may consume (16MB)
If there is no section already for this, place the above line at the end of the file. - Restart Apache.
The next two solutions are more restricted in scope and, in some cases, may be more appropriate choices than affecting all sites.
.htaccess
Edit the .htaccess file in the Drupal root directory. Look for the section:
# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.and immediately after this add the following line:
php_value memory_limit 16Msettings.php
If Drupal is already installed, you can edit sites/default/settings.php. This method will affect only the site using this file.
Locate the PHP settings section and add the following line at the end of that section:
ini_set('memory_limit', '16M');Shared Hosting
In some shared hosting environments, access to the PHP memory limit setting is restricted. If you cannot make the change yourself, please ask your hosting provider to adjust it for you, or look for a new host that allows more flexibility.
Check your change has taken effect
In all cases, it pays to ensure that your change is actually working. Use phpinfo to verify that your memory actually is what you want it to be. If your change doesn't seem to be working, double-check the location of php.ini displayed in the phpinfo page. Some systems have multiple copies of that file in different places. Only one is used and the others are red herrings.
Finding php.ini on your Local Server
- For MAMP see http://drupal.org/node/66187 particularly the "Optional: Adjust PHP's memory limit for scripts" section (note the difference for MAMP Pro).


0 comments:
Post a Comment