Fatal error: Allowed memory size of XX bytes exhausted (tried to allocate XX bytes) in /directory/filename.php on line XX
This error typically occurs when trying to upgrade WordPress or may be displayed for various elements on the dashboard.
The error indicates that there is a restriction on the amount of memory the system can allocate to perform a particular task, and there is not currently enough memory available. This error may start to show up after a new plugin has been installed.
To resolve this issue you need to try and either reduce the memory requirements of your WP implementation, or increase the available memory.
Decrease WordPress memory requirements
If the error only shows up when trying to upgrade WP, you may be able to temporarily deactivate all plugins, undertake the upgrade, and then reactivate them. However, if the error is impacting on the functionality of your installation, then try and deactivate any unnecessary plugins.
If this works, and the error is resolved, be aware, that the problems may very well recur if you install more plugins.
Increase System Memory
Depending on your hosting environment, you may be able to allocate additional memory via the following process. However, there will be a limit on how much memory is available to you, so there is a chance that this “fixs” will have no impact. If this is the case, you should contact your host provider and see if they are able to allocate more memory for you (this may involve upgrading your hosting, and / or paying extra)
To try and increase memory allocation, try the following :
Create or edit a local php.ini file in the wp-admin directory (and also, possibly the directory where the error is occuring) and insert the following:
max_execution_time = 30 ; Maximum execution time of each script, in seconds
max_input_time = 60 ; Maximum amount of time each script may spend parsing request data
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
upload_max_filesize = 8M ; Sets a file Upload limit to 8Mb
What if it doesn’t work ?
Your host may not allow the Memory Limit increase, or they may have a setting which overwrites (or limits) the changes you made. If nothing seems to work, contact your host provider and find out if they allow you to increase that limit and which method ought to be used.