Try decreasing the “Max Page Size” – error
-
Hey
I have been using Better Search Replace for many years and I had had no need to contact support for a very long time. I am struggling with the
“An error occurred processing your request. Try decreasing the “Max Page Size”, or contact support.”
Even if I turn it down to 3000 and add a define( ‘WP_MEMORY_LIMIT’, ‘512M’ ); to the wp-config file and do a few hard refreshes it is still giving me the same error. When I search through the database it gets about half way before the error shows up.
-
Hi there!
Better Search Replace Support Team here, Thanks for reaching out with your query we would be happy to assist
Have you tried setting the “Max Page Size” to its lowest possible value of 1000?
If yes and the issue persists, can you try editing your wp-config.php file to replace this line –define( 'WP_DEBUG', false );
With these lines –define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
This means that any errors are logged to/wp-content/debug.log
, because some errors are not visible on screen.
Can you try the process again and then send on thedebug.log
file if created please.
More details about that at https://codex.www.ads-software.com/Editing_wp-config.php#DebugHmm this is strange I add the
define(‘WP_DEBUG’, true); // Turn on WP Debugging
define(‘WP_DEBUG_LOG’, true); // Log errors to wp_debug.log
define(‘WP_DEBUG_DISPLAY’, false); // Turns off error reporting on the front endTo the wp-config. Run the search and replace operation again. Get the error even on the lowest value of 1000. Then check the wp-content folder and do not see the debug log. I will have to contact the web host and ask about this.
Hi Paal,
You may also check the Help tab of Better Search Replace to confirm that WP_DEBUG is recognized as activated by the plugin.
Let us know how it goes for you.
I’m running into this same issue and was able to download the debug file, this is what I got:
20:29:30 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 335872 bytes) in /home/h9cmpsjnotqu/public_html/staging-mentalhealthismaternalhealth.nektormedia.com/wp-includes/class-wpdb.php on line 2320Hi @nektorsean ,
Better Search Replace Support Team here. Thanks for reaching out with your query, we would be happy to assist!
That error means that you are reaching your server’s memory limit. Please try increasing your WP_MEMORY_LIMIT to 256M or greater if you keep getting the error.
https://deliciousbrains.com/wp-migrate-db-pro/doc/memory-issues/#wordpress-memory-limit
You may have to contact your hosting provider for help in increasing the value.
Let us know if you have any other questions.
I’m having the same problem. I added the magic 3 lines to wpconfig and WP_DEBUG now shows as ENABLED. Memory is already at 512M.
Anything else I can try?
Thinking it has to do with the length of the string being searched for and/or the length of the string being replaced, I did some tests.
I have about 560 replacements (one per page/post) of a string that is 177 characters, replacing it with a string that is 71 characters.
Thinking those strings were too long, I cut it down to replacing a string of 40 characters with one of 12 characters. That should be well within the limits of the plugin.
It still tells me to decrease the Max Page Size. So, maybe it’s incapable of handling 560 replacements in one shot???
Is it possible to break it down so it does just 100 replacements at a time?
Do you know how many characters is the max string for searching and the max for replacing, and do you know the max number of replacements for one search/replace query??
Hi @hunter44 ,
It’s possible that you have one record in your database that is very large. Better Search Replace (BSR) uses your server’s memory to temporarily store this data as our plugin performs the search/replace, so it’s possible that your server’s memory couldn’t accommodate it.
One way to test this is to try running search/replace a few tables at a time, to see where it could be failing.
“Do you know how many characters is the max string for searching and the max for replacing, and do you know the max number of replacements for one search/replace query??”
— The lengths of the search and replace parameters are limited by your server’s Post Max Size. I think most servers have a Post Max Size value large enough to accommodate simple text strings.There really isn’t a maximum number of replacements per search/replace query. You may be limited by your server’s memory limit, or your server’s max_execution_time. BSR runs the search/replace by batches to try to ensure that it doesn’t go over your server’s limits.
Let us know if you have any other questions.
Hi there support team,
I don’t know if it helps but, on my case I noticed the error occurs on wpmkpostmeta.
If I don’t select it, everything works fine.
Hi @tetzas,
In your case, you may need to check if there are any large rows/records on your
postmeta
table.Have you already tried setting the “Max Page Size” to its lowest possible value of 1000?
If so, enabling
WP_DEBUG
andWP_DEBUG_LOG
might help identify the actual issue with that table.WP 6.7.1
WP_MEMORY_LIMIT: 2048M
PHP memory_limit: 2048M
Max Page Size: 1000
Only active plugin on the site is Better Search Replace 1.4.7This is the debug entry for the plugin crash.
[04-Dec-2024 20:11:08 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 20480 bytes) in /var/www/vhosts/nugenerecords.com/httpdocs/wp/wp-content/plugins/better-search-replace/includes/class-bsr-db.php on line 359
[04-Dec-2024 20:11:08 UTC] PHP Fatal error: Allowed memory size of 805306368 bytes exhausted (tried to allocate 32768 bytes) in /var/www/vhosts/nugenerecords.com/httpdocs/wp/wp-content/plugins/woocommerce/includes/admin/class-wc-admin-settings.php on line 952Why is the plugin running a WooCommerce file? That plugin is not even active!
If 2GB memory is not enough then this plugin is no longer fit for purpose. Shame, as it used to work well.
Just to note here, at a bit random, but
805306368
bytes is 768 MB, not 2 GB. A limit might be set at 2 GB, but that’s not where you’re running out of memory or what it’s running at. There are many factors. Still, a lot of memory to be sure.The fact of the matter is the allocated PHP memory is 2GB. Why the plugin sees only 768MB is part of the problem.
Here is a solution for one of the cases:
When you want to change an old domain name of your website in all tables and use a new domain name for replacement:
1. Just do not replace anything in your *_blogs and *_options tables but only in the others. (If you have a Multisite/Network installation of WordPress, exclude the *_site table too.)2. When the replacements in all the selected tables is finished, replace the domain name in the *_options table only. This will lead to the situation that you will be forces to re-login on the new domain name but do not login yet!
3. Using phpMyAdmin or other database tool change the old domain name with the new one in the *_blogs table. If you are using a WordPress Multisite/Network installation change the domain name in *_site too + the domain name in the text row
define( 'DOMAIN_CURRENT_SITE', 'www.your-old-domain-name.com' );
with the new one in wp-config.php in your WordPress installation directory.
4. Login to your WordPress admin panel under the new domain name.
That’s all, folks!PS: It seems that the plugin is using the URL with the old domain name to access the script page for replacement in the request and when it is changed in the process it results in an error and inability to continue the replacement process.
Thank you @denra. Is that a remedy to the memory issue as well?
Try it and see. It seems that it is probably not a memory issue but an access one which leads to a wrong error message.
- You must be logged in to reply to this topic.