Age of Article Warning:
This article was originally published 63 months ago. The information, tips and techniques explained may outdated. Examples shown on this page may no longer work. Please consider this when viewing the below content.
With all the functionality that goes into our WordPress websites, it’s important to keep an eye out for errors. One error that you cannot miss, is a white screen with text at the top saying “Fatal Error : Memory Size Exhausted”.
This is because the default for PHP memory for your website is probably only 32M. This doesn’t go far anymore. So here’s the steps to check how much memory you have and increase it.
[highlight class=”highlight_yellow” style=””]Step 1.[/highlight]
First we need to analyse the site, using a PHP info code. Simply open up a blank file, insert into it:
<?php phpinfo(); ?>
and then save the file as phpinfo.php. FTP that file into the public_html section of your website. Navigate on your web browser to yourDomainName.com/phpinfo.php
Then do a search for “memory_limit”. You will probably see it set as 32M
[highlight class=”highlight_yellow” style=””]Step 2.[/highlight]
Now try to increase the memory size. Depending on your server configuration and access levels, you should try to up the quota by trying the following in the order shown. After each attempt, be sure to check if the memory limit has increased by reloading the phpinfo.php page. When that technique has worked you don’t need to try the next one.
A) Add to wp-config file:
B) Add to .htaccess file:
[php]php_value memory_limit 64M[/php]
C) Add to php.ini:
Create a blank file and call it php.ini. Insert into it:
[php]memory_limit = 64M[/php]
Upload/FTP this file into the public_html directory of your website where WordPress is installed. You may also need to add this file to the wp-admin directory if still having memory issues.
[highlight class=”highlight_yellow” style=””]Step 3.[/highlight]
The previous step talks about where to add the code to increase memory for WordPress. You can change the memory sizes to suit your needs, for eg: 32,64,128,256 or 512mB
[highlight class=”highlight_yellow” style=””]Step 4.[/highlight]
Check that the WordPress memory errors have resolved and that you can access your pages thoroughly. Then don’t forget to delete the phpinfo.php file off your website.