HostMonster Web Hosting Help

Wordpress Fatal error: Allowed memory size exhausted

Memory allocation and exhaustion problems within WordPress installations.
By default, our servers allow up to 32MB of data to be transferred via PHP. Not having enough memory can result in errors that look similar to this one:

        Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 2515174 bytes) in /path/to/wordpress/file.php on line 1331 

Before we get started, it is important to understand which of the three PHP settings you are using for your hosting account. Please see this article to learn how to check your PHP settings.

If using "PHP5 (Single php.ini)" or "PHP5 (FastCGI)", simply locate the "php.ini" file inside "public_html/" directory; for the standard "PHP5" setting, make a copy of the php.ini file first and place it in the "wp-includes/" directory. If the php.ini file cannot be located, a new php.ini.default file can be created via the cPanel PHP Config icon. Be sure to rename the file to php.ini, it will not function while named php.ini.default.

Within the php.ini file, modify the "memory_limit" value. The php.ini file can be edited with any text editor, including the "Edit" or "Code Edit" option within your HostMonster File Manager. With the file open, search (ctrl+f) for memory_limit or scroll down to approximately line 232. Here you should see the following line:

        memory_limit = 32M      ; Maximum amount of memory a script may consume (32MB)

Simply update this number to accommodate for a higher amount of memory; we suggest setting the value as "64M," as this fulfills most common requirements. Be sure to save any changes. Next, open the file wp-settings.php (located within the directory where Wordpress is installed). Near the top of this file look for:

        define('WP_MEMORY_LIMIT', '32M');
Update this value to the new memory limit as well. Save changes to the file. Once the file is saved, the effect should be immediate.

Note: To check and see that the memory_limit has been updated properly, create a new text file called info.php within the same directory you edited your new php.ini file. Create this new file and add the following code:

        <?php phpinfo() ;?>

Then view this page in a browser (be sure to include the directory in the URL if this is where you placed the info.php file). The PHP settings including the memory_limit should have changed. This will also show the path to the php.ini file which is being used.

Knowledgebase Article 151,025 views bookmark tags: exceeded fatal memory php wordpress (updated 1538 days ago)

Was this resource helpful?

Did this resolve your issue?

Please add any other comments or suggestions about this content:

Recommended Help Content

I get this with some of my php files: Fatal error: Unable to read X bytes in /home/user/public_html/myfile.php on line Y (updated 2190 days ago)
Knowledgebase Article 90,785 views tags: php unable

How to install the php.ini file and then increase the PHP Memory limit. (updated 83 days ago)
Video "How-to" Tutorial 152,927 views tags: limit troubleshooting wordpress

How do I increase my file size limit in my PHP application? (updated 179 days ago)
Knowledgebase Article 328,368 views tags: optimize php upload uploads

Related Help Content

An exported .sql file shows as a different size than the reported size in cPanel (updated 1576 days ago)
Knowledgebase Article 26,268 views tags: backup database dump export mysql mysqldump size sql

Wordpress Error: Unable to create directory /wp-content/uploads/2009/mydir/summer/ Is its parent directory writable by the server? (updated 2154 days ago)
Knowledgebase Article 46,816 views tags: create unable wordpress

This article explains how to add CPU and memory upgrades to a CloudSites account. (updated 5 days ago)
Knowledgebase Article 202 views tags: add cloudsites cpu memory resources upgrade

When creating a symlink to a php page, I get a 500 error. I am able to use symlinks to other files and folders fine. (updated 1944 days ago)
Knowledgebase Article 56,363 views tags: link php

How to customize your html or php error pages. (updated 1063 days ago)
Knowledgebase Article 72,461 views tags: errors php

Trying to send out emails from multiple email accounts fail from both webmail and third party email clients. Possible Reasons: The maximum emails per hour has been exceeded. This can be caused by forw (updated 157 days ago)
Knowledgebase Article 264,258 views tags: email exceeded mailbox outlook quota receive receiving send sender squirrelmail unable

I'm trying to configure an application (phpList) and it requires that I enter (in config.php) a username and password for a POP3 account to handle bounces. I keep getting a POP3 error and it can't log (updated 2202 days ago)
Knowledgebase Article 73,165 views tags: list mail php phplist

I installed TikiWiki and I am getting the following error: Notice: Only variable references should be returned by reference in /home/~/lib/adodb/ on line 2741 Notice: Only variable refere (updated 2189 days ago)
Knowledgebase Article 59,648 views tags: fantastico php wiki