If you run a large WordPress site you know that when running a plugin that will take a while to complete often results in a blank white screen, or a timeout error. This could happen running anything that could take a while to complete such as exporting data, importing data, etc.
Here we are going to show you how to defeat the timeouts during long-term operations of some WordPress Plugins. But first a word of caution, backup, backup, backup. Use this at your own risk.
Now that we got that out of the way let’s get started.
We typically use wordops.net to install WordPress with NGINX, SSL, and some other goodies. So this article revolves around that. You could use this on other setups but these steps are for an NGINX setup.
Step 1 php.ini
For a WordOps setup it is located at /etc/php/7.4/fpm (the number is php version ie., 8.0 etc)
FPM is the FastCGI Process Manager and holds config files for PHP FastCGI PHP language interpreter open PHP.ini and find and increase these times and memory limit. I used 30000 so that to put them back I just drop off two 0s ie., to 300. Memory limit is precaution upped it to 250m from 128 M
max_execution_time = 30000
max_input_time = 30000
memory_limit = 250M
Step 2 www.cong and www-two.conf
Head over to /etc/php/7.4/fpm/pool.d and find www.conf and www-two.conf edit both files and change request_terminate_timeout to 30000 (from 300).
Then restart PHP FPM with service php7.4-fpm restart
Step 3 nginx.conf
The last thing that we need to do is to prevent NGINX from timing out. So head over to /etc/nginx/nginx.conf
Then find fastcgi_read_timeout and up it to 30000 (from 300, same as above).
Now, test the nginx config file using nginx -t to make sure there is no errors before saving. If there is no errors and it shows okay, then restart nginx with service nginx restart.
We hope you find this article useful and remember to always backup and backup the backup. Don’t forget to change back your settings after you are done running your script.
Need help with your WordPress site? Contact Us for a FREE quote.