Support

Documentation

WordPress CLI (WP-CLI) integration

Akeeba Backup for WordPress version 3.0.1 and later integrate automatically with WP-CLI, the standard way of managing your WordPress site from the command line. Akeeba Backup provides commands to manage your backup profiles, change your backup and filter settings, take backups, manage your backups and download the backup archives.

[Note]Note

The akeeba backup take command to take new backups is only available to Akeeba Backup Professional edition since it relies on other features which are only available in the Professional edition. You can take backups with Akeeba Backup Core from the command line using our free of charge Akeeba Remote Control CLI.

Some commands which act on features only available in the Professional edition, e.g. setting regular expression filters, are also available in Akeeba Backup Professional only.

In any case, trying to use a WP-CLI command in Akeeba Backup Core which is only available in Akeeba Backup Professional will result in an error message with relevant information.

The full list of command can be found by running wp help akeeba against your site.

You can get help for specific subcommands the standard WP-CLI way, e.g. wp help akeeba backup for all the backup related commands or wp help akeeba backup take to get help on taking backups.

Please be careful when using the WP-CLI integration. It's extremely powerful and can reach into areas of the engine configuration which may be hidden from the interface. Always use a throwaway backup profile or, better yet, a throwaway clone of your site to test new things: it's possible to use the WP-CLI integration in such a way that completely screws up a backup profile beyond practical recovery. At the very least use the wp akeeba profile export command to export your backup profile into a JSON file which you can use to recover it from.

Enjoy writing automations for your site!

How can I automate the restoration of backups?

The obvious problem for restoring your site is that the restoration overwrites it. This means that you can not use a tool such as WP-CLI which needs uninterrupted access to your site's files. The restoration needs to take place through a self-contained script which does not rely on WordPress' files.

There are two solutions for that.

If you have some money but not much time to spare. We have created Akeeba UNiTE, a standalone CLI tool which can restore any backup taken with Akeeba Backup for WordPress. This tool is only available to our subscribers who have a subscription that gives them access to any of our backup software (including Akeeba Backup for Joomla! and our standalone Akeeba Solo application).

If you have some time but not much money to spare. You can use existing free of charge tools to semi-automate the restoration. You can download the backup archive in a predictable location with a predictable name either using wp akeeba backup download or using Akeeba Remote CLI. Then, you can use our free of charge Akeeba Kicsktart to extract the backup archive. However, this only restores the files, not the database. You will still need to access the /installation/index.php URL of your site from a browser to run the restoration script which was included in the backup archive and click on Next to finish up the restoration. If you are really into automating everything please note that is something you can do without too much effort using Selenium WebDriver, a headless installation of Firefox and some scripting.

If you choose to use free tools to automate the restoration we'd greatly appreciate a donation. Making this software takes us an average of 140 hours every week (yes, it's obviously more than one person involved in making this software). We have families to feed. If we can't feed our families we'll stop making software - or at least stop making it available for free. Thank you for your understanding and for being awesome!

WP-CLI and taking backups with Akeeba Backup Core (the free of charge edition)

Most of the WP-CLI commands are available in both Akeeba Backup Core (free of charge) and Akeeba Backup Professional (subscription-based) editions of Akeeba Backup. There are a few exceptions out of strict necessity.

The akeeba backup take command to take new backups is only available to Akeeba Backup Professional edition since it relies on other Pro-only features to work properly. You can still take backups with Akeeba Backup Core from the command line using our free of charge Akeeba Remote Control CLI application. The difference is that Remote CLI connects to your site with the JSON API, thus eliminating the need for the special CLI backup code we only ship with Akeeba Backup Professional.

Some commands which act on features only available in the Professional edition, e.g. setting regular expression filters, are also available in Akeeba Backup Professional only. This ought to be self-understood; you can't configure something which doesn't exist and which you can't use.

In any case, trying to use a WP-CLI command in Akeeba Backup Core which is only available in Akeeba Backup Professional will result in an error message telling you that this feature only works with the Professional version.

Important information about using WP-CLI against a remote site (SSH, HTTP, HTTPS)

[Important]Important

Even though Akeeba Backup's WP-CLI commands will work no matter how you connect to your site (locally, over SSH or over HTTP / HTTPS) we strongly advise against taking and downloading backups over HTTP / HTTPS.

Taking backups is a resource intensive process which takes a long time. It's very unlikely that your server will allow you to take a full backup of any non-trivial site without timing out. We recommend using any of our remote backup interfaces (either the legacy front-end backup or the backup JSON API) instead. For example, you can use Akeeba Remote CLI which uses our JSON API to take backups. Clarification: taking backups will work over SSH just fine. It's only over HTTP / HTTPS that it won't work.

Downloading large files, such as backups, over an HTTPS connection will very likely result in corrupt or truncated backup archives for the same reason; your server will time out before the backup is complete. We advise you to use FTP in Binary transfer mode, FTPS or Akeeba Remote CLI's chunked download mode instead. All of these methods are optimised for transferring large backup archives.

Further to that, features which rely on writing to local files -- exporting backup profiles and downloading backups while passing a --file=something parameter -- will NOT work properly unless you are connecting to your site locally (passing the local folder of a site). That's because the WP-CLI commands run locally to the WordPress site. As a result, file operations are local to your WordPress site, not where you have your command line open. Both commands allow you to send the files to the standard output so you can redirect it to a local file, e.g. wp akeeba backup download 123 > local_file.jpa.

Please note that these issues can not be addressed programmatically in our WP-CLI integration. They are limitations of how either WP-CLI or your web server work. We strongly advise you to use the alternative options presented in the paragraphs above. Any "bug" reports about issues resulting from ignoring these warnings will be replied to with a link to this documentation page.

Cookies Notification - Action required

This website uses cookies to provide user authentication and improve your user experience. Please indicate whether you consent to our site placing these cookies on your device. You can change your preference later, from the controls which will be made available to you at the bottom of every page of our site.