Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



Wordpress - Fix Err...
 
Share:
Notifications
Clear all

[Solved] Wordpress - Fix Error Allowed memory size exhausted

1 Posts
1 Users
0 Likes
693 Views
 Hans
(@hans)
Famed Member Admin
Joined: 11 years ago
Posts: 2703
Topic starter  

Running into the error "Fatal error: Allowed memory size of ... bytes exhausted (tried to allocate ... bytes) in /path/to/wp-includes/some.php on line xyz" ?

Note: I had my page cut off for no obvious reason. In a case like that I usually first look in Console log of my browser (eg. F12 in Google Chome) to see if something obvious can be seen there. If that doesn't clarify anything, then I briefly enable the debugging in Wordpress, by changing or adding these settings in the wp-config.php file in the root of your Wordpress directory:

Enable debugging:

/*
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', false); 
define('SCRIPT_DEBUG', false); 
*/

 define('WP_DEBUG', true);
 define('WP_DEBUG_DISPLAY', true);
 define('WP_DEBUG_LOG', true); 
 define('SCRIPT_DEBUG', true); 

Reload the affected page after saving the wp-config.php file and see if there are errors visible (viewing the page source may be needed).
After that I quickly revert back by changing the text in wp-config.php back to:

Disable debugging:

define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
define('WP_DEBUG_LOG', false); 
define('SCRIPT_DEBUG', false); 

/*
 define('WP_DEBUG', true);
 define('WP_DEBUG_DISPLAY', true);
 define('WP_DEBUG_LOG', true); 
 define('SCRIPT_DEBUG', true); 
*/

 

So this is where I ran into the error which basically tells me that PHP/Wordpress did not have permission to allocate enough memory. Seems by default, WordPress automatically tries to increase PHP memory limit if it is less than 64MB. But most of the time 64MB is not high enough.

There are a few ways to increase the allowed memory allocation, but you'll need to set it for Wordpress as well.

Here we edit the wp-config.php file again and add the following line somewhere before the "That’s all, stop editing! Happy blogging." comment:

define( 'WP_MEMORY_LIMIT', '256M' );

This code tells WordPress to increase the PHP memory limit to 256MB. Obviously up to you what value you use here. Do not go overboard, and keep in mind that you may have to update the php.ini file as well.


   
ReplyQuote
Share: