Increase WordPress Memory Limit

Snippets WordPress

If you get this message: “ Allowed memory size of bytes exhausted ” – it means you have too little memory allocated on our system for your wordpress installation to run properly. Often this is caused by having too many plugins activated or too many functions written into your functions.php file. There a differents ways around solving this, both in wordpress it selfs, but also in your system server config. Were going to explain them all, both the wordpress settings and the server tweaks in general, so you dont get too frustrated when one method doenst work.

Before you start hacking your wordpress site – try deactivating all your active wordpress plugins and see if the problem goes away. then start activating your plugins one by one, to see wich wone causes the problem. This it self will obviuosly not solve the problem, but it will give you an idea on how and where to solve the problem – and maybe help you too decide wich darlings to kill, should there be no way for you to increase your PHP memory consumption limit on your hosting system.

A little introduction on how to manage PHP memory consumption in WordPress.
The WP_MEMORY_LIMIT option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as “Allowed memory size of xxxxxx bytes exhausted”. This setting increases PHP Memory only for WordPress, not other applications.

By default, WordPress will attempt to increase memory allocated to PHP to 32MB (code is at beginning of wp-settings.php), so the setting in wp-config.php should reflect something higher than 32MB.

WordPress will automatically check if PHP has been allocated less memory than the entered value before utilizing this function. For example, if PHP has been allocated 64MB, there is no need to set this value to 64M as WordPress will automatically use all 64MB if need be.

*Note, these methods requires your web host to allow your account to consume the actual amount of memory your trying to set. Also, just because your able to write your own php.ini or .htaccess file , doesnt mean the settings of these documents will take effect – they will only take effect if your hosting provider has allowed for this.

Instructions for setting PHP memory consumption limit in WordPress (wp-config.php)
For seting the memory limit in wordpress – add the following code to your wp-config.php .

Instructions for settings the PHP memory comsumption limit on your server (php.ini)
* This also helps if you need to raise the memory for more than just your WordPress sites.
The PHP memory comsumption limit can also be raised by using a php.ini file on your server. If one doesn’t already exist, you can create a php.ini file file in your document root. Then add the following code to your php.ini file.

Instructions for settings the PHP memory comsumption limit on your server (.htaccess)
* This also helps if you need to raise the memory for more than just your WordPress sites.
The PHP memory comsumption limit can also be raised by using a .htaccess file on your server. If one doesn’t already exist, you can create a .htaccess file file in your document root. Then add the following code to your .htacces file.

Related links:
http://codex.wordpress.org/Editing_wp-config.php

1
Leave a Reply

avatar
0 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
0 Comment authors
Recent comment authors
  Subscribe  
newest oldest most voted
Notify of