Getting started with PHP Backup Utility (PHPBU)

Background

PHPBU is a PHP framework used to create backups, move data to other servers or cloud services using a simple XML configuration file.

PHPBU requires PHP 7.0, although if you don’t have access to PHP 7 you can use PHPBU version 4.0.10. PHPBU requires the DOM, JSON and SPL extensions, normally enabled by default. Note, different backup sources may need their respective executable binary too i.e. mysqldump .

Get detailed information about all features and documentation from the PHPBU website.

View the changedlog and download previous versions.

Installing PHPBU

The easiest way to get PHPBU is by downloading the latest phar archive. The PHAR extension provides a way to put entire PHP applications into a single file. PHAR archives provide a method to distribute a complete PHP application in a single file and run it from that file without the need to extract it to disk. PHAR is kind of like a thumb drive for PHP applications.

To globally install the PHPBU PHAR:

You can also use the downloaded PHAR file directly:

Configuration

To use PHPBU you need a XML configuration file. You can validate the config files using the PHPBU schema definition found at schema.phpbu.de. PHPBU normally expects a file name of phpbu.xml.

The following is a good starting point for backing up a website and MySQL database. The files are moved via FTP to a backup server.

Create the backup

Test the backup by executing from the command line.

If the PHAR and XML file are in the same path you can execute like this:

Backup CRON

Scheduling of backups can be done with a cron. To execute backups at 11:55 use:

Make sure you test the job from the command line first. Successful output example:

PHPBU Backup Execute Output
PHPBU Backup Output

You May Also Like

About the Author: George

Close Bitnami banner
Bitnami