One of the more common errors that seems to crop up with WordPress installation is a Fatal Memory error something along the lines of the following :
Fatal error: Allowed memory size of XX bytes exhausted (tried to allocate XX bytes) in /directory/filename.php on line XX
This error may occur for various elements on the dashboard, or when trying to upgrade WordPress.
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. The problem sometimes starts 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.
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 steps. However, there will be a limit on how much memory is available to you, so there is a chance that these “fixes” 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, use the following following processes :
(note their are various methods to do this – depending on what version of WordPress you are running, so some of these suggested methods may not apply to you)
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 = 84M ; Maximum amount of memory a script may consume (64MB)
upload_max_filesize = 20M ; Sets a file Upload limit to 8Mb
; safe mode
safe_mode = Off
open the file wp-includes/cache.php and place the following code immediately after the opening <?php tag:
ini_set(‘memory_limit’,’64M’); // set memory to prevent fatal errors
Create a .htaccess file in the wp-includes directory and insert the following directive:
# set memory limit for cache.php
php_value memory_limit 64M
open the file wp-settings.php (in the root directory) and increase the :
entry. Save the file and refresh.
open the file wp-includes/default-constants.php and increase the :
entry (note there may be different setting for Multisite configurations)
Save the file and refresh.
In your WP installation root folder, find the file named: wp-config.php
Open the file to be edited in your favorite editor
after the lines :
/** Database Charset to use in creating database tables. */
/** The Database Collate type. Don’t change this if in doubt. */
Add this code to your wp-config.php file
Save the file and refresh your wordpress page and it should not give the error again.
And that’s it. Save, upload, test and check for additional errors. If necessary, you may wish to try alternate values for the memory limit (e.g. 32, 64, 128, 256) – although be aware that there will be a physical limit imposed by your hosting environment, so any values greater than that will have no benefit.
What if Nothing works !!!
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.