wordpress - memory limit exhausted due to number of posts - php

I have installed wordpress on my client's server . The website has 10,0000 posts .
When I had less number of posts, there was no issue but now is throws this error
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 35 bytes) in /home/content/22/11685822/html/wp-includes/taxonomy.php on line 2790
I tried adding the below in my php.ini file ,
memory_limit = 64M ;
still does not seem to solve the problem .
Kindly help.

try defining max memory in wp_config like this : define( 'WP_MEMORY_LIMIT', '96M' );

First open your wp-config.php which is located in the root WordPress directory. Then add the following line inside the main php tag:
define('WP_MEMORY_LIMIT', '64M');

I had faced same problem when I had used custom taxonomy. The cause of my problem I
did recusive call to post_tags_meta_box function (responisible for default tag feature add/update function). If you increase memory limit it does not solve your problem.
Cause of the problem might be leak in your code, or possibly an infinite loop.
So I would sugegst to try to figure out the problem instead of increase the memory size.

Related

Wordpress out of memory error in wp-db.php

I am doing a live update of a Wordpress site and after editing the front, i tried update it and it gave me this error:
Fatal error: Out of memory (allocated 117440512) (tried to allocate 61440 bytes) in ../wp-includes/wp-db.php on line 1851
I have done all memory increasing tweaks but nothing seems to work. All other functionality and pages work perfectly fine.
This one WordPress Memory Exhausted Error
You need to paste this code in wp-config.php file just before the line that says ‘That’s all, stop editing! Happy blogging.’
define( 'WP_MEMORY_LIMIT', '256M' );
Your script is dying after a certain memory usage, You can get around it by increasing your memory_limit in php.ini file.
ini_set('memory_limit','512M');
Hope this helps..

Fatal Error PHP won't seem to go away [duplicate]

I'm getting an error when I try to open one of my dashboard pages in my wordpress script
The error message is as follows:
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried
to allocate 71 bytes) in
/home/admin/domains/filesick.com/public_html/wp-includes/taxonomy.php
on line 2685
I asked around and was told I have to increase the memory_limit to something higher than 256M, so I changed it to 512M and still the same problem. Then I changed it to 3024M and this is what I have now, but that didn't fix the problem.
So could you please tell me how to fix this and what should I do?
Waiting for your response.
WordPress overrides PHP's memory limit to 256M, with the assumption that whatever it was set to before is going to be too low to render the dashboard. You can override this by defining WP_MAX_MEMORY_LIMIT in wp-config.php:
define( 'WP_MAX_MEMORY_LIMIT' , '512M' );
I agree with DanFromGermany, 256M is really a lot of memory for rendering a dashboard page. Changing the memory limit is really putting a bandage on the problem.
I had this problem. I searched the internet, took all advices, changes configurations, but the problem is still there. Finally with the help of the server administrator, he found that the problem lies in MySQL database column definition. one of the columns in the a table was assigned to 'Longtext' which leads to allocate 4,294,967,295 bites of memory. It seems working OK if you don't use MySqli prepare statement, but once you use prepare statement, it tries to allocate that amount of memory. I changed the column type to Mediumtext which needs 16,777,215 bites of memory space. The problem is gone. Hope this help.
I changed the memory limit from .htaccess and this problem got resolved.
I was trying to scan my website from one of the antivirus plugin and there I was getting this problem. I increased memory by pasting this in my .htaccess file in Wordpress folder:
php_value memory_limit 512M
After scan was over, I removed this line to make the size as it was before.

Wordpress Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in /wp-includes/meta.php on line 837

I am new in wordpress. i am getting below error.
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried
to allocate 72 bytes) in
/wp-includes/meta.php on line 837
while accessing new post page. and also i have added below code in htaccess file.
<IfModule mod_php5.c>
php_value memory_limit 512M
</IfModule>
Please help me to sort out this issue.
Try adding this line to your wp-config.php file:
define('WP_MEMORY_LIMIT', '64M');
If you have access to your PHP.ini file, change the line in PHP.ini
If your line shows 32M try 64M:
memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)
If you don't have access to PHP.ini try adding this to an .htaccess file:
php_value memory_limit 64M
Talk to your host.
In my case deleting old wordpress post revisions helped. Also you can restrict the amount of revision per article or disable it altogether.
Here's how I did it: Limit or Disable and clean up old wordPress revisions
Debug your WordPress installation with these Basic WordPress Debugging Techniques.
I found many WordPress themes showing this error due to a wildcard searching all through the database. If possible, control the query's posts_per_page from -1 to something reasonable.
And the increment in Memory Limit is sometime a temporary solution if your code is buggy, or giving enormous load to your system that your system is not prepare in handling.
Changing the memory limit is usually only masking the real problem, unless you have it set to some really low value. The problem itself is usually hard to pinpoint.
In my case the problem was caused by someone that set the number of posts per page to some absurdly high value like 999 in my case:
When I found it the solution was easy - I just decreased it to something reasonable like 100.

Fatal error Allowed memory size exhausted with WooCommerce WordPress plugin

I keep getting the error below when adding an item to my cart. It just started showing up and I have more than enough memory left in the database. I have searched online to find a solution and I have tried all of them: editing the php.ini, editing .htaccess and putting a php.ini in wp-admin. Any help will be greatly appreciated.
Fatal error: Allowed memory size of 125829120 bytes exhausted (tried
to allocate 65484 bytes) in
/homepages/22/d515555101/htdocs/wp-content/plugins/woocommerce/includes/class-wc-cart.php
on line 259
Find the default-constants.php file on wordpress\wp-includes folder.
Try changing line 23 :
define('WP_MEMORY_LIMIT', '40M');
to :
define('WP_MEMORY_LIMIT', '128M');
Are you using WooCommerce Tickets plugin by Modern Tribe? If so, then you need to download the latest version (3.9.2) and install that. (You'll likely need to deactivate and delete the old version). For some reason it's not giving alert that an upgrade is available.
I had tried everything suggested on other forums and finally found this solution and it was the only thing to solve my problem. Hope it helps you!

website down with php error

i do not know php but had installed wordpress, i visit my site and see the following error
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 98304 bytes) in E:\Domains\mysite.com\wwwroot\wp-content\plugins\wordfence\lib\wfLog.php on line 431
PHP Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 98304 bytes) in E:\Domains\mysite.com\wwwroot\wp-content\plugins\wordfence\lib\wfLog.php on line 431
how do i fix hat above, please guide
You have a plugin called Wordfence which is causing the problem. It appears to be overloading your memory. I wouldn't mess with your server config, the problem is with the plugin. Try deleting those logs, that should work, but it may only be a temporary solution. Removing the plugin would certainly solve the problem. No idea what Wordfence is though. If that doesn't work, change the title of your question to include "Wordfence plugin".
In my opinion i have got a better solution for you. All you need to do is just to increase memory size.
By default, when you installed and configure Wordpress it comes by 16MB memory . In your case, you can keep the plugin you already installed and add the following one line code to your wp-config.php file.
You can access this file via FTP(File Transfer Protocol) client FileZilla or from your hosting cPanel.
/* Increase memory */
code : define( 'WP_MEMORY_LIMIT', '96M' );

Categories