Note: increasing PHP
'Php-Memory limit' is different from increasing 'PHP-upload' size limit.
You can learn to increase upload size on page: here.
The standard PHP memory requirements for Drupal core are a bare minimum. Sites that run many contrib modules, or particularly memory-intensive ones, will need more. 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.
This is the recommended approach if you have access to the server's php.ini. This will not be possible in some shared hosting environments, though your host may be able to adjust it for you. 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 click the "more information" link on Drupal's status page's PHP section. which shows the phpinfo() page. Locate the Configuration File (php.ini) Path row on that page. During installation Drupal checks the PHP Memory Limit, and if it is less than 32M (16MB for Drupal 6), 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 = 64M ; Maximum amount of memory a script may consume (64MB)
If there is no section already for this, place the above line at the end of the file.
- Restart Apache.
php.ini in the Drupal root folder
Add the following line to a php.ini file in your Drupal root folder:
memory_limit = 64M
This will only work if PHP is running as CGI/FastCGI.
.user.ini in public_html folder (for PHP 5.3 and up)
PHP 5.3+ allows you to change the memory limit by placing a .user.ini file in the public_html folder.
Simply create the above file and type the following line in it:
memory_limit = 64M
Some cPanel hosts only accept this method.
The next two solutions are more restricted in scope and, in some cases, may be more appropriate choices than affecting all sites.
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 64M
This method will only work if PHP is running as an Apache module.
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:
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.
For some hosts renaming php.ini to php5.ini may be necessary.
Some hosting services require the following line in .htaccess to enable a php.ini file.
For some hosts (CrazyDomains) you may need to add the following lines to the php.ini file (if they are not there already):
extension=pdo.so extension=pdo_sqlite.so extension=sqlite.so extension=pdo_mysql.so
Modifying php.ini in local server environments
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).
If you are using XAMPP/WAMP, there may be two PHP.ini files (one under the PHP directory and the other under Apache/bin). To change your memory limit, edit the file in the XAMPP/Apache/bin directory.
Check your change has taken effect
In all cases, it pays to ensure that your change is actually working. Check Drupal's status report 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. Some systems have multiple copies of that file in different places. Only one is used and the others are red herrings.
For Drupal 6 you might want to try the Drupal Tweaks module which allows you to increase your PHP memory limit without editing any files.
XHprof is a good solution to find high memory consumption. See this page for more instructions on how to install and use it: http://groups.drupal.org/node/82889