---
title: "Fixing Timeouts during Build / Restore"
url: https://phatdev.net/en/docs/sl-migrations/how-to-handle-server-timeout-issues
lang: en
updated: 2026-10-20
alternate:
  vi: https://phatdev.net/docs/sl-migrations/how-to-handle-server-timeout-issues
markdown: https://phatdev.net/en/docs/sl-migrations/how-to-handle-server-timeout-issues.md
---

# Fixing Timeouts during Build / Restore

Part of the doc set: [SL Migrations](https://phatdev.net/en/docs/sl-migrations.md)

> The server times out - the build or installer stops midway.

## Server Timeout Issues

Symptoms: the build runs for 30-60 seconds and then stops, or installer steps 1-3 report `504 Gateway Timeout`.

## Cause

Every layer of the stack has its own timeout. You need to raise all of the relevant layers.

## PHP layer

Raise these values in `php.ini` (or `.user.ini` in the web root):

```ini
max_execution_time = 600
max_input_time = 600
memory_limit = 1024M
```

After editing, reload PHP (on a VPS) or wait a few minutes (on shared hosting with .user.ini).

## Web server layer (Nginx/Apache)

The web server also has its own timeout for PHP requests.

**Nginx** - edit `fastcgi_read_timeout` in the config:
```
fastcgi_read_timeout 600;
```

**Apache** - edit `Timeout` in the config:
```
Timeout 600
```

On shared hosting, contact support to have it raised.

## CDN / reverse proxy layer

If the site uses Cloudflare or another proxy, these services usually have a hard timeout (Cloudflare Free: 100s). It cannot be raised on the free plan.

**Workaround**: temporarily bypass the CDN while building/restoring:
- Open the installer through the origin IP + a local `hosts` file
- Or pause the Cloudflare proxy (cloud icon → grey)

## The plugin splits work into chunks

The plugin automatically splits the build/restore into small chunks. Each chunk is processed within a safe timeout limit and then calls the next chunk through AJAX. If the plugin chunks evenly and you still hit a timeout → the AJAX request is being cut off by the web server or the CDN.

## Very large sites

The current build has no WP-CLI command for building. For a very large site, keep the DupArchive engine (the default; it builds in blocks and can resume after a timeout), raise the timeouts at every layer as above, and see [Two-Part Install](https://phatdev.net/en/docs/sl-migrations/two-part-install) to extract manually when you restore.

## See also

- [Server resources](https://phatdev.net/en/docs/sl-migrations/how-to-manage-server-resources-cpu-memory-disk)
- [Two-Part Install for large sites](https://phatdev.net/en/docs/sl-migrations/two-part-install)
