note: increasing PHP memory limit is different from increasing PHP upload size. You can learn to increase upload size here.
A PHP memory limit of 32MB is the minimum requirement for Drupal 7 (16MB for Drupal 6), and 64MB is recommended. Some sites may need more than 64MB if they are using certain contributed modules such as Views and Panels. Memory limits of 128MB and higher are not unusual. 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 root folder
Add the following line to a php.ini file in your site root folder:
memory_limit = 64M
This will only work if PHP is running as CGI/FastCGI.
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):
Modifying php.ini in local server environments
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 reportto 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.