This site utilizes JavaScript to function correctly. Looks like it's disabled on your browser. Please enable it for your best experience.

For instructions on enabling JavaScript, click here

Skip to main content

Just Host 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 Just Host 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 297,483 views bookmark tags: exceeded fatal memory php wordpress


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
Knowledgebase Article 182,536 views tags: fatal php read unable

How to install the php.ini file and then increase the PHP Memory limit.
Video "How-to" Tutorial 492,946 views tags: limit troubleshooting wordpress

How do I increase my file size limit in my PHP application?
Knowledgebase Article 633,319 views tags: optimize php upload uploads

Related Help Content

WordPress Error: Unable to create directory /wp-content/uploads/2009/mydir/summer/ Is its parent directory writable by the server?
Knowledgebase Article 238,943 views tags: create unable wordpress

This article explains how to add CPU and memory upgrades to a CloudSites account.
Knowledgebase Article 123,424 views tags: add cloudsites cpu memory resources upgrade

If you have a WordPress blog hosted on WordPress.com, you can easily export it and import it to WordPress that is installed on your hosting account with justhost. Login to the WordPress Data
Getting Started Article 700,198 views tags: blog export file import wordpress

How to customize your html or php error pages.
Knowledgebase Article 162,048 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
Knowledgebase Article 587,472 views tags: email exceeded mailbox outlook quota receive receiving send sender unable

This article will explain how to add a PHP handler to your .htaccess files. This is useful if you want to customize the version of PHP that runs your PHP files.
Knowledgebase Article 402,373 views tags: htaccess php

Changing PHP versions, load custom Apache mods, and other Apache/PHP customizations
Knowledgebase Article 151,987 views tags: easyapache php vps whm

Database Size and Table Limits.
Knowledgebase Article 215,984 views tags: database limits size tables

** Google ad credits are only available to customers in the United States, Canada, and the United Kingdom at this time.

¹ VAT (Value Added Tax) is not included in our advertised price and will be charged separately and itemized on invoices and billing information. Standard VAT rates based on EU Member State regulations may apply. Learn more.