Installing a Backup From the Command Line
Do you have SSH access to your server and want to install a backup without opening the installer in a browser? Duplicator, our backup and migration plugin, lets you run installer.php from the command line, either with prompts or with every value set in advance.
In this guide, we’ll show you how to install a backup from the command line.
Before You Get Started
To begin, download the archive file and the installer of your backup. You’ll find both on the Backups page of the source site, or in the storage where you keep the backup.
Next, upload both files to the folder of the destination site, such as public_html. The installer file name must end in .php, so rename it to installer.php if it has another name.
Then, connect to the server with SSH and go to that folder:
cd /home/example/public_html
Checking the Backup Before You Install
Before you install, it’s a good idea to check the backup. The --info option describes the backup and lists the installer parameters you can set from the command line, with their current values. It doesn’t install anything.
php installer.php --info
The first part of the output shows details about the backup:
Backup
name: 20261110_examplecom_[hash]_20261110140132_archive.daf
created: 2026-11-10 14:01:32
site: single site
url: https://old.example.com
path: /var/www/html
table prefix: wp_
database only: false
no database: false
duplicator: 5.2.0
wordpress: 7.1.3
php: 8.2.35
database: 12.3.3
Below that, you’ll see each parameter you can set in a --params file, with its type, a short description, its current value, and the accepted values. For example, dbaction lists what the installer can do with the database:
dbaction (string): What to do with the database
value: empty
- create: Create New Database
- empty: Empty Database
- removetables: Overwrite Existing Tables
- manual: Skip Database Extraction
- rename: Backup and Rename Existing Tables
- dbdonothing: Only Extract Files
Running the Install
To install the backup with prompts, run the installer with the URL of the new site:
php installer.php --url=https://example.com
The installer asks for each database value you didn’t pass. A value in brackets is the default, and pressing Enter keeps it. The password isn’t shown while you type.
Extracting the installer...
Database host [localhost]: localhost
Database name: example_db
Database user: example_user
Database password:
Validating...
After the validation, the installer shows a summary of the install and asks you to confirm:
Run installer with these settings?
Site Settings
Install Type: single site
New URL: https://example.com
New Path: /home/example/public_html
Database Settings
Server: localhost
Name: example_db
User: example_user
Data: No existing tables will be overwritten in the database
This process cannot be undone. Proceed? [y/N]:
To start the install, type y or yes and press Enter. Any other answer cancels the install.
If the validation finds warnings you need to accept, the installer stops, even on a terminal. After you check the warnings, run the command again with --accept-warnings.
Installing Without Prompts
Do you want to run the install from a script, without any questions? You can pass every value as an option, or put the values in a --params file.
A --params file is a JSON file. Each key is an installer parameter, and each value goes inside "value". For example, create a file named install-params.json outside the site folder:
{
"dbhost": {"value": "localhost"},
"dbname": {"value": "example_db"},
"dbuser": {"value": "example_user"},
"dbpass": {"value": "your-database-password"},
"dbaction": {"value": "empty"},
"blogname": {"value": "Example Site"}
}
Then, run the installer with the file, the site URL, and --yes:
php installer.php --url=https://example.com --params=/home/example/install-params.json --yes
The installer shows each step as it runs. When it’s done, it prints the site URL and the path of the installer log:
Extracting the installer...
Validating...
Run installer with these settings?
Site Settings
Install Type: single site
New URL: https://example.com
New Path: /home/example/public_html
Database Settings
Server: localhost
Name: example_db
User: example_user
Data: No existing tables will be overwritten in the database
Setting the parameters...
Decompressing the database...
100%
Extracting the files...
100%
Installing the database...
100%
Updating the site...
Running the final tests...
Finalizing...
Installation completed: https://example.com
Log: /home/example/public_html/wp-content/duplicator-backups/installer/dup-installer-log__[hash].txt
Without a terminal, such as in a script or a cron job, the installer never asks anything. If a required value is missing, it stops with an error, such as Error: --dbname is required.
Command Options
The table below shows every option of installer.php and what it does:
| Option | What it does |
|---|---|
--url=<url> | Sets the URL of the new site. |
--dbaction=<action> | Sets what to do with the existing database, such as empty or rename. |
--dbhost=<host> | Sets the database host, with :port when needed. |
--dbname=<name> | Sets the database name. |
--dbuser=<user> | Sets the database user. |
--dbpass=<password> | Sets the database password. For security, the --params file is a better place for it. |
--params=<file> | Reads installer parameters from a JSON file. |
--archive-path=<path> | Sets the folder of the archive, or the archive file itself. By default, it’s the installer folder. |
--archive-password=<pwd> | Sets the password of an encrypted archive. |
--accept-warnings | Installs even when the validation shows warnings that need to be accepted. |
--yes | Installs without asking for confirmation. It’s required without a terminal when the install overwrites an existing site or database. |
--ignore-owner | Runs even when your user isn’t the owner of the installer folder. |
--info | Describes the backup and its parameters, then exits without installing. |
--format=<format> | Sets the output of --info: text (default) or json. |
--help | Shows the help. |
Exit Status Codes
When the command ends, it returns an exit status. Scripts can use it to check the result:
- 0: the backup was installed, or
--infoor--helpran. - 1: the install failed or was cancelled. The command shows the error and, when a log exists, the line
Details are inwith its path. - 2: the command was used the wrong way, such as an unknown option.
After the Install
Once the install completes, open the new site in your browser and log in to check it.
By default, the installer removes the installer files when it finalizes the install. It keeps its log in wp-content/duplicator-backups/installer/, and the Log: line shows the exact path.
If the output shows installer files kept or a can’t remove warning, remove the leftover files yourself. To learn which ones to delete, check out our guide on removing the installer files after an install.
FAQs
Below, we’ve addressed some of the most common questions regarding this feature.
--archive-password, or the command stops with an error.--ignore-owner?Error: run as www-data, the owner of /home/example/public_html (now root), or pass --ignore-owner. The best fix is to run the command as the user it names. If you’re sure about the permissions, add --ignore-owner.That’s it! You now know how to install a backup from the command line, with prompts or with a parameters file.
As a next step, check out our complete guide to the installer to learn what each installer setting does.