Scope: Prime Mover Free / Pro version

Background

This error means your server has insufficient timeout setting to complete the process. Prime Mover usually states at which specific method the error occurs. So please take note when reporting or fixing this specific error. It could be the method that handles the database dump, copying media directory, etc.

When this error occurs, Prime Mover executes shutdown procedure, terminates the process and cleans the temporary directory of any unfinished files or folders to prevent clogging your server.

There are several ways of fixing this error for which this tutorial shows.

Lower the default timeout retry value

By default, Prime Mover processes tasks in a 15 second interval batch. This may not be enough and could still hit timeout if your server timeout is very slow. For example, there are high chances of hitting the server timeout if its set to 20 seconds or 30 seconds. In this case, try lowering the default timeout to 10 seconds , clear your cache and try again.

Enable WordPress debug and check for fatal errors

Sometimes due to some PHP errors (usually fatal errors), it can cause timeout errors since PHP could no longer continue processing and it hits timeout (stalled process). You can check this by enabling WordPress debugging. The fatal runtime errors provide clues as to what is causing the errors. If its caused or points to a particular plugin, try deactivating that plugin and try again. Or if error is caused by Prime Mover or you aren’t sure what to do, please submit a bug ticket to us.

Otherwise if there are no PHP errors and you have tried lowering the retry timeout value as mentioned previously, it’s time to try server side settings. If you cannot change those below due to hosting restrictions, it’s fine – please create a support ticket so we can check if there are workarounds available.

PHP-fpm timeout configuration steps

The following steps works for PHP 7.0+ PHP-FPM in Ubuntu 16.04 + / Apache server . This requires root access to your server. Ideally you can get this with VPS or dedicated hosting.

  • Know your specific PHP version. You can get this via WordPress admin -> Tools -> Site Health -> Info -> Server .
  • Login to your SSH using root shell.
  • Go to this path: /etc/php/PHP_VERSION/fpm/pool.d , replace PHP_VERSION with your PHP verson. For example if you are using PHP 7.3.8, then its a PHP 7.3 version. So the path will be /etc/php/7.3/fpm/pool.d
  • Open the file www.conf
  • Look for request_terminate_timeout

By default request_terminate_timeout is disabled. So it will look like this (starts with semi-colon).

;request_terminate_timeout = 0

If you don’t have semi-colon that starts with that request_terminate_timeout then it means its currently using that timeout setting for your PHP processes.

To disable it, make sure you add semi-colon before it. For example say, a 60 seconds timeout is currently imposed in your PHP process:

request_terminate_timeout = 60

You can disable that by adding a semi-colon:

;request_terminate_timeout = 60

However if you only want to set a very high timeout setting, add the value say for example 1 hour timeout.

request_terminate_timeout = 3600

  • Restart PHP-fpm and Apache. This is the command to use:

sudo service php7.3-fpm reload;sudo service apache2 restart;

That assumes your PHP version is 7.3, just like illustrated in the above example. Replace php7.3-fpm with your actual PHP version (e.g. php7.0-fpm)

Changes needed on php.ini

Ideally none, since Prime Mover already adjust the runtime PHP timeout by using set_time_limit() and max_execution_time.

You can adjust memory_limit which is desirable to set it as high as possible to avoid getting any memory errors. However Prime Mover will attempt to increase memory settings during runtime just like WordPress does.

Just in case you really want to customize and test php.ini settings, these are the most important hard core settings if your hosting allows it (e.g. if your server can support 2GB memory or unlimited timeout)

upload_max_filesize=256M;
post_max_size=1024M;
memory_limit=2048M;
max_execution_time = 0;
max_input_time = 0;

If you are on super powerful dedicated server and exporting / restoring a very big site for which you have a big RAM (like 16GB or even bigger) – by all means use it, e.g. setting

memory_limit=16384M;

This will configure 16GB to PHP to be used for your site.

Apache timeout configuration steps

  • Go to /etc/apache2/
  • Find the file apache2.conf
  • Look for Timeout directive, by default this is set 30 0r 60 seconds. You will need to set this to a very high value , the same that you have set in PHP request_terminate_timeout

Note, in some configuration; this is added in httpd.conf. Please refer to this documentation in details.

If you are using any timeout related Apache module, you may need to disable or adjust them accordingly also. For example https://httpd.apache.org/docs/2.4/mod/mod_reqtimeout.html

Nginx timeout configuration steps

There are already several good tutorials on the Internet on setting Nginx timeout. Please read the following selected posts:

http://www.doublecloud.org/2014/03/nginx-how-to-fix-timeout-issues-and-more/

https://serverfault.com/questions/777749/how-to-disable-timeout-for-nginx

https://www.scalescale.com/tips/nginx/504-gateway-time-out-using-nginx/

Optimize your large site with Prime Mover

There is a guide that shows the details on how to migrate and backup sites with Prime Mover particularly for large sites.

Was this article helpful?
YesNo