Home » Linux, Web

Fatal error: Allowed memory size of 33554432 bytes exhausted

20 February 2011 No Comment

Fatal error: Allowed memory size of 33554432 bytes exhaustedFor the most part, WordPress is easy to use and you can set up your site in a few hours. This assumes everything works as expected. If things don’t work out as you have expected, then it will take some more troubleshooting to get to the root cause of the problem.

For instance, have you ever upgraded your WordPress site or installed or upgraded a plugin? If you have played around WordPress for more than a few hours, then you probably have. Did you encounter something unusual? When I upgraded my WordPress recently, I got this error message:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 30720 bytes) in /home/xyz/public_html/wp-admin/includes/template.php on line 798

When you go back to your WordPress administrator console, you get this error message. What do you do? What does it mean?

It means your site has reached the maximum amount of memory allocated by your ISP. You should contact your ISP to upgrade your shared hosting site.

If you have already upgraded your site and you are still getting this error message, it means you have to increase the PHP memory in your WordPress site too. By default, WordPress will allocate PHP to use 32 MB of memory. If you have been allocated 64 MB of memory on your shared hosting site, you need to make this change in WordPress so that it knows about the increase in availability of memory.

In your public html folder, there should be a file called wp-settings.php. In this example, the public folder is located in /home/xyz/public_html/wp-settings.php. Add this line in your configuration file:

define( ‘WP_MEMORY_LIMIT’, ’64M’ );

You can add it anywhere after the opening <?php tag and before the closing ?> tag. This change is instant. It will increase the PHP memory in your WordPress site to 64 MB of memory.

That should do it. If, for whatever reason, it doesn’t work, you can try this option. Add a php.ini file in your public_html/wp-admin folder. In this example, it would be in /home/xyz/public_html/wp-admin/php.ini. Include the following lines in this file:

upload_max_filesize = 64M
post_max_size = 64M

If neither of these steps work, it’s time to ask your ISP (Internet Service Provider) to increase your PHP’s memory allocation on your account. In most situation, if you have a shared hosting account, the memory limit will be set to 32MB which is not enough for WordPress. Ask your host provider to increase it to 64MB. If your hosting provider won’t accommodate your needs, maybe it’s time to look for another ISP.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.