Sanjeev Sabhlok's notes on technology, hardware, gardening

Out of memory message on WordPress – impossible to get out of this

Anubhava solved the problem, thus

"I just applied a carpet bomb process to kill all the processes owned by unix owner [user] and that killed some stray processes and hence released all the held up memory."

And the code used was:

pkill -9 -U [user] -f php


My problem was I think less of memory than of memory usage on cpanel. As my hosting company wrote:

"The memory limit on the server on where you are is 132 MB, however, what's happening is that you are reaching to the 1 GB memory limit that your account have, you may want to optimize your wordress".


How to find how much memory you are allowed:



define('ABSPATH', dirname(__FILE__).'/');


define('WP_MEMORY_LIMIT', '64M');



memory_limit = 128M; Maximum amount of memory a script may consume (64MB)
max_execution_time = 45;
upload_max_filesize = 10M;
post_max_size = 20M;

Alternative advice on similar issue:

1) Please check php.ini file in the root/public_html folder of your site. Open php.ini file in text editor and change the values for memory_limit. By default it should see memory_limit = 8M. Try changing it to 12M. if it will not resolve the problem then try to increase it either 16M or 24M.   [Source]




The way I got it fixed was contacting the web host and asking them to fix the security issue (it seems that was the reason for the limit). It could be that for your case. 🙂  [sOURCE]


you just want this line in .htaccess
define('WP_MEMORY_LIMIT', '128M');   [Source]

2) If you can’t find the php.ini file, open up the PHP file which requires more memory and add this line just after ini_set(’memory_limit’, ‘12M’); we can increase memory upto 16M or 24M to resolve the issue. But do it try with 12M first.

3) Add this line in wp-settings.php file:

define(’WP_MEMORY_LIMIT’, ‘XXX’);  [Source]


To check if yuor host has enabled it you need to run a script on your host which calls php_info() and check the the configuration which should include -enable-memory-limit.
If it doesn't include that enable command then you are stuffed unless you can change php-ini.

If it does include that enable, then the best way to increase memory is to include the following in the script causing the problem.

<?php ini_set(memory_limit,64); ?>   [Source]


1. Open your text editor and copy the following code:


2. Save your file as: php.ini

3. Upload (FTP) to: the root directory of your blog (exactly where your wordpress blog lives)

4. Upload (FTP) again to: wp-admin (for example: wp-admin/php.ini)

5. You’re done! Try the automatic upgrade again and hopefully it will work this time.  [Source]

I’m on and after about 10 different tries, this is what worked for me – having the php.ini file in both places. Thanks!!!!   [ibid]


Try either of these to fix the problem
1. Create a file in your root /WordPress folder called php.ini , add this line in PHP.ini
memory_limit = 64M;
2. If you don’t have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 64M

You can also try increasing it to 128M or 256M

If that doesn't work – contact your web host provider for their preferred method. [Source]


After trying a number of suggested cures unsuccessfully, including

  • Setting memory_limit = 48M in php.ini (No difference)
  • Editing the file with the error to add ini_set(’memory_limit’, ‘48M’); (No difference)
  • Adding define(‘WP_MEMORY_LIMIT’, ’64M’); to wp-settings.php. (Yep! No difference)
  • Adding a line php_value memory_limit 32M in .htaccess file (Which causes a fatal Internal Server Error)  [Source]


The fix for the WordPress Out Of Memory Error, on the problem site at least, was to disable all the installed plugins, and then carry out the automatic upgrade again. This time it ran like a dream, and the site was back in order once the plugins had been re-enabled, with WordPress 3.2.1 installed.

The only regret in finding the solution is that we did not disable the plugins one at a time, in order to see which one was the trigger. However, on a working site with a large following, that extra delay it did not seem appropriate. [ibid]

ADDENDUM november 2013

still getting: Fatal error: Out of memory (allocated 61079552) (tried to allocate 122880 bytes) in /home/sabhlok/public_html/wp-admin/includes/file.php on line 984



View more posts from this author

Leave a Reply

Your email address will not be published. Required fields are marked *