Support

Documentation

Chapter 2. Command line reference

Running UNiTE

UNiTE is a self–container PHAR file, an executable PHP application.

You can typically execute it by going into the directory where the unite.phar file is stored and running

/path/to/php unite.phar

where /path/to/php is the path to your PHP CLI executable. Please keep in mind:

  • You need specific versions of PHP to run UNiTE. If the PHP version is too old or too new you will very likely receive an error from PHP.

  • You must use the PHP CLI executable. You cannot use the PHP CGI executable; the latter is only meant to be used to serve web applications and will not work with a command line application like UNiTE.

If you are on Linux or macOS you can chmod +x unite.phar to make it executable. If you rename the file to unite (without a phar extension) and put it in a directory that's in your $PATH (typically /usr/local/bin) you can call UNiTE by simply typing unite instead of php /path/to/unite.phar . To the best of our knowledge this is not possible on Windows.

Please note that this will only work if running /usr/bin/env php -v returns something like this

PHP 8.1.10 (cli) (built: Sep  3 2022 12:09:27) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.10, Copyright (c), by Zend Technologies

The part in bold is what is important. It is the literal text PHP followed by the PHP version and something in parentheses. The version must be one of the supported versions of PHP per the link above and you MUST see cli between the parentheses. If this is not the case continue using UNiTE using the /path/to/php unite.phar command as explained above.

Automatic execution with a CRON script

UNITE works against XML, JSON or YAML site definitions. They tell it what to do. Since version 4.0.0 there is only one way to use UNITE: running it against a single XML, JSON or YAML file. Please note that batch mode was deprecated in version 3.1 and has been removed since version 4.0. You can always use a for-loop in your command line shell's scripting language to achieve the same result.

Your CRON job needs to run the unite.phar file with the path to the XML site definition for the site you want to restore as its argument. A sample CRON command line looks like this:

/usr/bin/php-cli /path/to/unite.phar /home/myuser/backups/mysite.xml

Keep in mind that scheduling of the CRON script is the responsibility of the user. This is customarily done through the Control Panel of your web server or through the crontab -e command on most Linux and *BSD systems.

If you are not sure how CRON jobs work, we advise you to consult the following third-party resources: