“Allowed Memory Size Exhausted” is a problem faced by WordPress users. I suffered a lot due to it. Each time I logged-in in the dashboard, I had this error. There was problem with uploading images, publishing a post, and almost each time a page is loaded this error appeared.
This is how the error looks like:
Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2356995 bytes) in /ANY-DIRECTORY/public_html/wp-includes/http.php on line 1331
I believe that the reason behind this is the use of lots of plug-ins, which makes the WordPress heavier. Since many php scripts are executed each time a page is loaded, these exceed the default php memory limit provided by the hosting company.
Many people are facing this problem in upgrading to WordPress 3.0, because the new WordPress 3.0 installation is heavier than the previous one because of the merger of WordPress MU, Twenty Ten Theme and many new features. The below mentioned tricks are compatible with WordPress 3.0.
To Fix the php memory error you can do the following:
1) Reduce the number of plugins by removing unnecessary plugins.
2) Contact your hosting company and ask them to increase the php memory.
3) Migrate your hosting to a better, renowned hosting company. This solution is the best if you can afford it.
4) Add the following lines to your wpconfig.php file in WordPress installation folder. If you find it difficult to edit this file manually then you can use a WordPress plugin, Memory Bump, it automatically adds the required lines of code to the wpconfig.php file (this method didn’t work for me).
Add this line after after the <?php tag
5) You can edit php.ini file but not every hosting company provides you access to this file, so this won’t work for everyone. If you have access to this file you can easily increase your php memory.
6) Edit .htaccess file. and add the following lines at the beginning of the file-
php_value memory_limit 64M
This method worked for me. The occurrence of “Allowed Memory Size Exhausted” error is reduced to a high extent. It is almost to nonexistent now.
Anyone of the above mentioned tricks will surely work for you. If you experience any problem, have any doubt, let me know in the comments.