This past weekend when I converted a website from HTTP to HTTPS, I utilized the “Better Search Replace” plugin to ensure that all of my internal links and database links were replaced to reflect the new HTTPS website URL. While using the plugin, I encountered an error message that read as follows: “An error occurred processing your request.”
Like most people, I copied and pasted the error message into Google search and discovered several threads in which others also experienced the problem and brainstormed solutions. Perhaps the most helpful thread for me was one created in response to this problem by Matt Shaw, the developer of the Better Search Replace plugin.
How to Fix: Better Search Replace “An error occurred processing your request”
Matt Shaw (@mattshaw) outlined 2 things to try if you end up with the dreaded: “An error occurred processing your request. Try decreasing the “Max Page Size”, or contact support.”
Decrease the “Max Page Size”
To decrease the maximum page size, you’ll want to first click on the Better Search Replace plugin within your WordPress dashboard. Next, you’ll want to click on the “Settings” tab and you’ll see a slider in which the maximum page size can be adjusted. Simply drag the slider all the way to the left of your screen until the maximum page size is as low as the plugin will allow.
Do not drag the maximum page size all the way to the right. (I accidentally dragged in the wrong direction thinking that increasing my max page size would help – it didn’t). After seeing many others experiencing this error message, I’m not quite sure why the plugin doesn’t automatically default to the lowest possible page size.
Nevertheless, decreasing the maximum page size might solve your error outright. Once you’ve decreased your maximum page size, try doing a “Dry Run” with the plugin. If you don’t get another “error occurred processing your request,” then your problem is solved.
Increase memory limits (PHP, .htaccess, .wp-config)
If you are still getting the error message after decreasing the maximum page size, it may be due to the fact that your PHP memory limit has been exceeded. According to the plugin developer, the Better Search Replace plugin attempts to break up the “search/replace” process over batches to decrease memory consumption. However, if your website is close to the memory limit or has restrictions in place, you’ll need to increase PHP memory limits for the plugin to function properly (and avoid the error message).
To increase PHP memory limits, you’ll need to login to your website hosting account and click on “File Manager.” Make sure that the checkbox for “Show Hidden Files” is checked and then click on “Go.” You’ll want to adjust the memory limits in several files associated with your website for a chance at the plugin working properly.
PHP.ini file: In your “wp-admin” folder you’ll see a file called “php.ini” or “php7.ini” or something similar. You’ll want to right click on the file and edit it to reflect the values listed below. (You may want to record the preexisting values in case of errors and/or you want to change values back to default later).
- upload_max_filesize = 1000M
- post_max_size = 2000M
- memory_limit = 3000M
- file_uploads = On
- max_execution_time = 180
.htaccess file: In your website files, you should be able to locate a file called “.htaccess.” If you don’t see your .htaccess file, there’s a good chance that it’s hidden (you need to ensure that hidden files and folders are shown by checking the proper box). When you’ve located the .htaccess file, you’ll want to find and edit the code to reflect the values listed below.
- php_value upload_max_filesize 1000M
- php_value post_max_size 2000M
- php_value memory_limit 3000M
- php_value max_execution_time 180
- php_value max_input_time 180
wp-config.php file: Next, locate the wp-config.php file in your website files. In your wp-config.php file, you may need to edit or add code to the bottom of the script right above the “happy blogging” line.
- define(‘WP_MEMORY_LIMIT’, ‘3000M’);
Clear your cache: When you’re done editing these files, be sure to clear cache via plugins and your browser.
Now that you’ve (potentially dramatically) increased memory limits and cleared all cache, it’s time to run the Better Search Replace plugin and determine if your problem is fixed. There’s a good chance that the plugin will work properly now without any errors. Increasing memory limits as I’ve outlined above solved the problem for me when I continued getting a frustrating error message that persisted after decreasing the maximum page size. If the plugin successfully completes a “Dry Run” – your problem is solved.
Deactivate other plugins
If you’re still somehow experiencing the “error occurred processing your request” message, it might be due to conflicting plugins – or plugins that interfere with the function of Better Search Replace. Try deactivating all of your plugins (or as many plugins as you can) and then run the Better Search Replace through a “Dry Run.” If your search and replace seems to work fine now, there’s a good chance that one (or multiple) plugins were interfering with its ability to make changes.
What to do if you’re still getting an error message after trying the above recommendations?
If you continue to get the “error occurred processing your request” from the Better Search Replace plugin after making the aforementioned recommended changes, there are a few things you can still do.
- Check for dated plugins & WordPress: Ensure that all of your plugins are updated and that you’re using the latest version of WordPress.
- Selecting tables: You could also try selecting a subset of tables in the database for a “Dry Run” and omit others (such as if you think specific table selections or too many table selections are interfering with the plugin’s function).
If for whatever reason nothing seems to solve your problem and you need to do a find and replace in your database, you could:
- Consider alternative plugins: While the “Better Search Replace” plugin is probably the best plugin for doing a Search/Replace in WordPress, there are other options. For example, the plugin “Search & Replace” may be a viable alternative if you can’t get “Better Search Replace” working.
- Buy the premium version: There’s a premium version of “Better Search Replace” that provides customer support. Chances are good that if you pay for the premium version – the staff will help you solve your problem.
- Hire a web specialist: Sometimes hiring someone to do the Search/Replace for you is your best bet. It might save you a lot of time, stress, and headaches.
- Contact your host: Certain hosts may help you perform the Search/Replace. For example, the web host Kinsta has their own Search/Replace tool and great support for making changes within the database.
Have you experienced the “error processing your request” from Better Search Replace?
If you’ve dealt with the dreaded “error processing your request” while using the Better Search Replace plugin, leave a comment. If you’ve read through this tutorial, I’d appreciate some feedback via answering the questions I’ve listed below. If you found my tutorial helpful and/or it solved your problem – be sure to let me know!
- Were you able to solve this error and get the “Better Search Replace” plugin working?
- If you solved the error, what was the solution that worked for you?
- If you weren’t able to solve the error, did you try any alternative plugins?
Boy, oh boy! THANKS! I finally made it work on a client’s website. This is the ONLY plugin I use and it always worked. I am not sure why it didn’t right off the bat but I turned all the plugins off and that did the trick + changing a few server things as you describe. MANY thanks! :)
Thanks dude, I used this plugin loads and its always worked without an issue. Got the error today, googled, tried step 1, no joy, step 2, sorted it.
Would have probably figured it out myself eventually but you saved me some time, so for that, TA MATE :)
Thanks! I had to change the PHP.ini file to make it work.
I use Plesk, and had already selected the highest values in my PHP settings (on the page: [https://domain.com:port]/smb/web/php-settings/id/1). Whatever you select here gets written to your PHP.ini file. I guess the highest values you can select from the drop-down menu here weren’t high enough in my case, so I added your suggested settings:
upload_max_filesize = 1000M
post_max_size = 2000M
memory_limit = 3000M
file_uploads = On
max_execution_time = 180
To the box ‘Additional directives’ on the PHP settings page in Plesk (scroll all the way down to find this box), and it worked!
For me, it works when I set PHP to 7.1.