Giter VIP home page Giter VIP logo

Comments (24)

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

Hi,
here is an example xml config.
Try to remove the scheme and host for the bucket name.

<sync type="amazons3">
      <option name="key" value="KEY" />
      <option name="secret" value="SECRET" />
      <option name="bucket" value="phpbu" />
      <option name="region" value="eu-central-1" />
      <option name="path" value="/phpbu-backup/%Y" />
</sync>

What version of PHP are you using?

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

Above 5.5 and using json.

And no, it threw other errors before that. Will try the xml version. But
nevertheless.

On Thursday, February 4, 2016, Sebastian Feldmann [email protected]
wrote:

Hi,
here is an example xml config.
Try to remove the scheme and host for the bucket name.

What version of PHP are you using?


Reply to this email directly or view it on GitHub
#50 (comment)
.

Costin Moise aka necenzurat

Tel: +4 0726.459.188 | Github https://github.com/necenzurat | Linkedin
http://www.linkedin.com/in/necenzurat

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

You can use json that shouldn't matter at all.
Have you tried to remove the scheme and host for your bucket value?

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

Yea, it said it must have s3.amazon.

On Thursday, February 4, 2016, Sebastian Feldmann [email protected]
wrote:

You can use json that shouldn't matter at all.
Have you tried to remove the scheme and host for your bucket value?


Reply to this email directly or view it on GitHub
#50 (comment)
.

Costin Moise aka necenzurat

Tel: +4 0726.459.188 | Github https://github.com/necenzurat | Linkedin
http://www.linkedin.com/in/necenzurat

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

Hi, this configuration is working fine for me.

"syncs": [
    {
      "type": "amazons3",
      "options": {
        "key": "MYKEY",
        "secret": "MYSECRET",
        "bucket": "phpbu",
        "region": "eu-central-1",
        "path": "/phpbu-backup/%Y"
      }
   }
],

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

nope, i'm getting this error

Exception 'phpbu\App\Backup\Sync\Exception' with message 'The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint: "s3.amazonaws.com".'
in phar:///usr/local/bin/phpbu/Backup/Sync/AmazonS3.php:130

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

I found this on the web:
http://www.sitefinity.com/developer-network/forums/set-up-installation/amazon-s3---must-be-addressed-using-the-specified-endpoint
This isn't really up to date, but maybe it helps.

If the bucket isn't the problem I would encourage you to install phpbu via composer and install the latest version of the AWS SDK (2.8.*) via composer.

You can check the AWS version bundled within the PHAR with phpbu --manifest

If it works with your composer installed phpbu it's a problem with the bundled AWS version and I will release an update with the latest 2.* version.

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

So, installed via composer

{
    "require": {
        "phpbu/phpbu": "^2.1",
        "aws/aws-sdk-php": "2.8.*"
    }
}

And then i get this gem

Exception 'phpbu\App\Backup\Sync\Exception' with message 'The difference between the request time and the current time is too large.'
in /app2/vendor/phpbu/phpbu/src/Backup/Sync/AmazonS3.php:130

ok, that was my fault, the time was 2 hours ahead, fixed that, but the bucket need's to be

bucket-name.s3.amazonaws.com

😢

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

Please check your local system time.
Amazon is blocking requests with a time difference greater than 15 minutes.

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

fixed that, but no good

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

Still the time difference exception or back to "The request signature we calculated does not match the signature you provided. Check your key and signing method." ?

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

back to The request signature we calculated does not match the signature you provided. Check your key and signing method.

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

This is somehow the code phpbu executes to upload your backup to AWS S3.

<?php
use Aws\S3\S3Client;

require 'vendor/autoload.php';

$key = '';
$secret = '';
$localFile = ''; // test.txt
$region = ''; // aws region
$bucket = ''; // bucket name
$remoteFile = ''; // /foo/bar/test.txt

$s3 = S3Client::factory(
    [
        'signature' => 'v4',
        'region' => $region,
        'credentials' => [
            'key' => $key,
            'secret' => $secret,
        ]
    ]
);
$fh = fopen($localFile, 'r');
$s3->upload($bucket, $remoteFile, $fh, 'private');

This is nearly copy & paste of the AWS documentation.
With the code above you can test the AWS functionality without phpbu in your way.

This way you hopefully find your problem.

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

The upper code says the same error. 😢

Ok, so i did a test with s3tools and it worked.

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

This sounds more and more like a php environment problem.
Do you have the opportunity to test it on a different system?
Preferably one with a differently setup os and php version.

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

tested it on another server, same problem, maybe it's the sdk?
error

PHP Fatal error:  Uncaught Aws\S3\Exception\SignatureDoesNotMatchException: AWS Error Code: SignatureDoesNotMatch, Status Code: 403, AWS Request ID: 912A1E9FAC564353, AWS Error Type: client, AWS Error Message: The request signature we calculated does not match the signature you provided. Check your key and signing method., User-Agent: aws-sdk-php2/2.8.27 Guzzle/3.9.3 curl/7.38.0 PHP/5.6.9-0+deb8u1
  thrown in /home/test-aws/vendor/aws/aws-sdk-php/src/Aws/Common/Exception/NamespaceExceptionFactory.php on line 91

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

I find that hard to believe. The AWS sdk is a widely used framework and uploading a file is so basic that it's very unlikely that there is a bug that exists in version 2.7.x and still exists in 2.8.x
But nothin is impossible.
Don't know how I can help you from here :(

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

I just released version 3.0.0 with the latest AWS SDK version.
Hopefull this fixes your problem.

Just execute
$ phpbu --self-update
to upgrade to the latest version

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

Hi @necenzurat, I will close this ticket for now, if you have any further remarks feel free to reopen it.

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

3.0.0
it's quite an improvement, now i get this gem of an error:

PHP Warning: fwrite() expects parameter 1 to be resource, boolean given in phar:///usr/local/bin/phpbu/Backup/Sync/AmazonS3v3.php on line 49

i get a successful upload but no file is in the s3 bucket
😢

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

OK looks like the Amazon stream wrapper can't open a stream to the S3 bucket.
And I missed to validate that the stream was created successfuly. So you get a warning instead of an exception and phpbu thinks everything went fine.

It drives me crazy that this isn't working in your environment

I still have to fix the missing validation thingy

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

it finally worked, on v.3, i had the old config with bucket-name.s3.amazonaws.com.

so yea, it was my fault. the correct settings for the v.3.0.1 and amazon with json sync are:

 "syncs": [
        {
            "type": "amazons3",
            "options": {
            "key": "___KEY___",
            "secret": "___SECRET___",
            "bucket": "bucket-name",
            "region": "us-east-1", 
            "path": "back/%Y" 
          }
        }

Region: us-east-1 (region list)

as soon as i have some time, ill try to make some updates to the documentation :)

from phpbu.

sebastianfeldmann avatar sebastianfeldmann commented on August 12, 2024

😄 happy it works

from phpbu.

necenzurat avatar necenzurat commented on August 12, 2024

me too and thanks for this awesome tool

from phpbu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.