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
https://phpbu.de
Other
1.29k stars 110 forks source link

Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in phar:///home/<site>/public_html/dbbackup/phpbu.phar/lib/symfony/process/Process.php on line 54 #356

Closed YouveGotMeowxy closed 8 months ago

YouveGotMeowxy commented 8 months ago

I'm trying out PHPBU and so far have setup a very basic config:

{
  "verbose": true,
  "backups": [
    {
      "name":"test",
      "source": {
        "type": "mysqldump",
        "options": {
            "databases":"test_Test",
            "user":"me",
            "password":"redacted"
        }
      },
      "target": {
        "dirname": "/home/site/public_html/dbbackup",
        "filename": "test-%Y-%m-%d-%H%i.sql",
        "compress": "gzip"
      },
      "type": "dropbox",
        "options": {
            "token": "redacted",
            "path": "/Backups"
        }
    }
  ]
}

The simulation says it's OK; but when I try a test run, I get the error:

Parse error: syntax error, unexpected '|', expecting variable (T_VARIABLE) in phar:///home/<site>/public_html/dbbackup/phpbu.phar/lib/symfony/process/Process.php on line 54

image

Nowhere in my config do I have a pipe (|) character; not sure how to proceed for here?

Can anyone help?

YouveGotMeowxy commented 8 months ago

the above was using PHP 7.4. I've also now tried all versions of PHP from 7.1, 7.2, 7.3 as well, and though those don't give the above error, they also appear to do nothing at all. No output during the simulation, no backups created:

image

@sebastianfeldmann

sebastianfeldmann commented 8 months ago

Version 6.0.22 is not compatible with php < PHP 8.0 anymore.

So to use the latest versions you have to upgrade to an officially supported PHP version. And even 8.0 doesn't even receive security patches anymore. So I would advice to upgrade to at least version 8.2 if not 8.3 :)

YouveGotMeowxy commented 8 months ago

OK, I managed to move further along, but now it gets hung up with this error:

invalid crypt configuration: type missing

And I copied the crypt example straight from the docs.

I've even run my entire JSON through chatgpt and it says the structure is good, so I'm completely lost on how to proceed next. Can someone look my JSON over and spot what's wrong, please?

{
  "verbose": true,
  "backups": [
    {
      "name": "domain",
      "source": {
        "type": "mysqldump",
        "options": {
          "databases": "domain_domain",
          "user": "domain_Name",
          "password": "redacted"
        }
      },
      "target": {
        "dirname": "/home/domain/public_html/dbbackup",
        "filename": "domain-%Y-%m-%d-%H%i.sql",
        "compress": "bzip2"
      },
      "crypt": [
        {
          "type": "openssl",
          "options": {
            "password": "redacted",
            "algorithm": "aes-256-cbc"
          }
        }
      ],
      "syncs": [
        {
          "type": "dropbox",
          "options": {
            "token": "kec",
            "path": "/DBBackups/domain"
          }
        }
      ],
      "cleanup": [
        {
          "type": "quantity",
          "options": {
            "amount": 30
          }
        }
      ]
    },
    {
      "name": "MI",
      "source": {
        "type": "mysqldump",
        "options": {
          "databases": "domain_mi",
          "user": "domain_mi",
          "password": "redacted"
        }
      },
      "target": {
        "dirname": "/home/domain/public_html/dbbackup",
        "filename": "mia-%Y-%m-%d-%H%i.sql",
        "compress": "bzip2"
      },
      "crypt": [
        {
          "type": "openssl",
          "options": {
            "password": "redacted",
            "algorithm": "aes-256-cbc"
          }
        }
      ],
      "syncs": [
        {
          "type": "dropbox",
          "options": {
            "token": "kec",
            "path": "/DBBackups/MIA"
          }
        }
      ],
      "cleanup": [
        {
          "type": "quantity",
          "options": {
            "amount": 30
          }
        }
      ]
    },
    {
      "name": "Images",
      "source": {
        "type": "mysqldump",
        "options": {
          "databases": "domain_images",
          "user": "domain_images",
          "password": "redacted"
        }
      },
      "target": {
        "dirname": "/home/domain/public_html/dbbackup",
        "filename": "images-%Y-%m-%d-%H%i.sql",
        "compress": "bzip2"
      },
      "crypt": [
        {
          "type": "openssl",
          "options": {
            "password": "redacted",
            "algorithm": "aes-256-cbc"
          }
        }
      ],
      "syncs": [
        {
          "type": "dropbox",
          "options": {
            "token": "kec",
            "path": "/DBBackups/Images"
          }
        }
      ],
      "cleanup": [
        {
          "type": "quantity",
          "options": {
            "amount": 30
          }
        }
      ]
    },
    {
      "name": "Blog",
      "source": {
        "type": "mysqldump",
        "options": {
          "databases": "domain_blog",
          "user": "domain_blg",
          "password": "redacted"
        }
      },
      "target": {
        "dirname": "/home/domain/public_html/dbbackup",
        "filename": "blogg-%Y-%m-%d-%H%i.sql",
        "compress": "bzip2"
      },
      "crypt": [
        {
          "type": "openssl",
          "options": {
            "password": "redacted",
            "algorithm": "aes-256-cbc"
          }
        }
      ],
      "syncs": [
        {
          "type": "dropbox",
          "options": {
            "token": "kec",
            "path": "/DBBackups/Blog"
          }
        }
      ],
      "cleanup": [
        {
          "type": "quantity",
          "options": {
            "amount": 30
          }
        }
      ]
    }
  ]
}

Ping @sebastianfeldmann :)

sebastianfeldmann commented 8 months ago

crypt should not be an array

"crypt": {
  "type": "openssl",
  "options": {
    "password": "redacted",
    "algorithm": "aes-256-cbc"
  }
}

That should fix your problem

YouveGotMeowxy commented 8 months ago

thank you so much! I got it all working!

One thing I thought might be worth mentioning; I had created a DropBox access token while I was working on this but couldn't get it all working, and then after getting it working was getting an 'expired access token' error. I went and created a new one and it all works.

I did a quick search and came up with something that seems to mention also needing the code to now require handling a "refresh" or "offline" token as well (or something like that), because dbox switched to only generating short-term access tokens.

https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/dropbox-exceptions-AuthError-expired-access-token/td-p/580407

sebastianfeldmann commented 8 months ago

Thanks for the heads up. I will close this now. I you have an further questions feel free to reopen this or open a new issue

YouveGotMeowxy commented 8 months ago

Thanks for the heads up.

@sebastianfeldmann

Any chance of getting this fixed pretty soon? The key expires every 4 hours now, meaning adding to a daily cron job always fails, because the key has expired. Then in order to get it working again the user has to go back to their dbox app page, regen an 4hr key, and replace them all in their .json config. For me right now that's 9 locations in the configs. :)

btw, just wanted to add, this is one of the greatest apps ever, lol. Once it's all setup and running smooth, it's soo awesome.