PHPBU is an essential PHP tool for anyone looking to create and encrypt backups, sync backups to other servers or cloud services and monitor backup creation with ease. One of its key features is its support for creating backups for a wide range of database engines, including but not limited to:

  • ArangoDB
  • Directories
  • Elasticsearch
  • InfluxDB
  • Ldap
  • MongoDB
  • MySQL
  • Percona XtraBackup
  • PostgreSQL
  • Redis

By providing support for such a diverse range of database engines, PHPBU ensures that users can rely on it for all their backup creation needs. Moreover, its encryption feature guarantees that backups are secure and cannot be accessed by unauthorized parties.

Another feature of PHPBU that sets it apart is its ability to sync backups to other servers or cloud services. This provides users with an additional layer of security, as backups are not only stored locally but also remotely. Users can choose from a variety of cloud services, including Amazon S3, Dropbox, and Google Drive.

Finally, PHPBU makes it easy for users to monitor backup creation. It provides detailed logs that allow users to track progress and troubleshoot any issues that may arise. With PHPBU, users can rest assured that their backups are being created and synced with ease and security.

Features

  • Create backup for: ArangoDB, Directories, Elasticsearch, InfluxDB, Ldap, MongoDB, MySQL, Percona XtraBackup, PostgreSQL, Redis, and MariaDB
  • Compress backups: it supports the following compression formats: bzip2, gzip, xz, and zip.
  • Validate backups: Check min size, comparing with previous backups
  • Encrypting backups: mcrypt, openssl
  • Cleanup your local backup
  • Generating backup reports in several formats: Text files, JSON file, Mail, Telegram and Webhook

Sync backup to other remote locations:

  • Amazon s3
  • Azure Blob
  • Dropbox
  • FTP
  • Google Drive
  • OpenStack
  • rsync
  • SFTP
  • Softlayer
  • Yandex Disk

Requirements

  • PHP >= 7.2
  • ext/curl
  • ext/dom
  • ext/json
  • ext/spl
  • POSIX Shell
  • tar
  • bzip2 or gzip

Installation

You can download a PHP Archive (PHAR) that bundles everything you need to run PHPBU in a single file.

wget https://phar.phpbu.de/phpbu.phar
chmod +x phpbu.phar
php phpbu.phar --version

For convenience, you can move the PHAR to a directory that is in your PATH.

mv phpbu.phar /usr/local/bin/phpbu
phpbu --version

Using PHIVE to install PHPBU.

phive install phpbu

Installing PHPBU via Composer is also supported.

"require": { "phpbu/phpbu": "^6.0"  }

Usage

phpbu [option]

  --bootstrap=<file>       A "bootstrap" PHP file that is included before the backup.
  --configuration=<file>   A phpbu xml config file.
  --colors                 Use colors in output.
  --debug                  Display debugging information during backup generation.
  --generate-configuration Create a new configuration skeleton.
  --limit=<subset>         Limit backup execution to a subset.
  --simulate               Perform a trial run with no changes made.
  --restore                Print a restore guide.
  -h, --help               Print this usage information.
  -v, --verbose            Output more verbose information.
  -V, --version            Output version information and exit.

Usage Examples

$ phpbu

This requires a valid XML PHPBU configuration file (phpbu.xml or phpbu.xml.dist) in your current working directory. Alternatively, you can specify the path to your configuration file. An important thing to note is that all path inside the configuration should be absolute or relative to the configuration file itself.

$ phpbu --configuration=backup/config.xml

Use the --limit option to execute only a subset of your configured backups.

$ phpbu --limit=myAppDB

A dry run without any actual impact is executed with the --simulate option.

$ phpbu --simulate

To show a guide how to restore your backup use the --restore option.

$ phpbu --restore

Configuration

Simple configuration example:

  <?xml version="1.0" encoding="UTF-8"?>
  <phpbu xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="http://schema.phpbu.de/6.0/phpbu.xsd"
         verbose="true">
    <backups>
      <backup name="myAppDB">
        <!-- source -->
        <source type="mysqldump">
          <option name="databases" value="mydbname"/>
          <option name="user" value="user.name"/>
          <option name="password" value="topsecret"/>
        </source>
        <!-- where should the backup be stored -->
        <target dirname="backup/mysql"
                filename="mysqldump-%Y%m%d-%H%i.sql"
                compress="bzip2"/>
      </backup>
    </backups>
  </phpbu>

License

Copyright (c) 2014 - 2018 Sebastian Feldmann <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Resources

GitHub - sebastianfeldmann/phpbu: PHP Backup Utility - Creates and encrypts database and file backups, syncs your backups to other servers or cloud services and assists you monitor your backup process
PHP Backup Utility - Creates and encrypts database and file backups, syncs your backups to other servers or cloud services and assists you monitor your backup process - GitHub - sebastianfeldmann/p…
phpbu - PHP Backup Utility
phpbu is a php framework that creates and encrypts backups and moves your backups to other servers or cloud services and assists you monitor your backup creation. Supported backups are MySQL, PostgreSQL, Directories, Redis, Elasticsearch and ArangoDB