How to fix a WordPress Memory exhausted error on your blog.

WordPress

How to fix a WordPress Memory Exhausted error in the Cache.php

Many times a blogger will insert a plugin thinking that everything will be fine and you will see the results immediately but instead after activating the plugin you are shown after logging back into the admin area.

PHP Fatal error:  Allowed memory size of 33554432 bytes exhausted (tried to allocate 6253909 bytes) in #### on line ### leaving you with no method of getting to the admin area getting only a white screen with this message.

After doing some research the results were 3 simple updates that fixed the problem and brought back the web site.

Step #1 – Make sure you have a FTP account with a username / password to retrieve the necessary files as well as uploading files. If you only have the web hosting control panel you will need to have that username / password and can get the job done by using the file manager.

Step #2 – Open wp-includes/cache.php and enter after

ini_set('memory_limit','32M'); // set memory to prevent fatal error

Save the file and go on to the next step.

Step #3 – Create a .htaccess file for the wp-includes directory and insert the following lines:

# set memory limit for cache.php
php_value memory_limit 32M

Step #4 – The final step is to create a local php.ini file in the same directory (wp-includes) and insert this:

;; set memory limit for cache.php
memory_limit = 32M

That is all you have to do and your blog should be back up working. Always make sure you have backups of your entire WordPress site that includes the Admin – Content – Includes along with the initial set of WordPress files. Finally get a SQL backup from the database that you are using, either MySQL or MS SQL but you need to get a complete backup, download it to a local machine.

Every single time you are doing an update on WordPress the point is to have insurance, a bad plugin or widget can destroy your theme by an out of place tag. Always be on the safe side.