atlet / phpbackupscript Goto Github PK
View Code? Open in Web Editor NEWBackups MySQL databases and directories to Amazon S3.
Home Page: http://www.princic.net
License: GNU General Public License v2.0
Backups MySQL databases and directories to Amazon S3.
Home Page: http://www.princic.net
License: GNU General Public License v2.0
S3 Region is hardcoded in backup-s3.php, I think it will be better to define it in config.php
I see that the database backup file has been created and is in the directory with the script. But he does not upload to S3.
After a long silence in the terminal (about 20-30 minutes), I get this answer:
~/PHPBackupScript $ php8.0 backup-s3.php
mysqldump: [Warning] Using a password on the command line interface can be insecure.
PHP Fatal error: Uncaught exception 'Aws\S3\Exception\S3Exception' with message 'Error executing "PutObject" on "https://my-bucket-name-here.s3.eu-central-1.amazonaws.com/2022-08-25-07-18-13/maindb-2022-08-25-07-18-13.sql.gz"; AWS HTTP error: Client error: `PUT https://my-bucket-name-here.s3.eu-central-1.amazonaws.com/2022-08-25-07-18-13/maindb-2022-08-25-07-18-13.sql.gz` resulted in a `400 Bad Request` response:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>RequestTimeout</Code><Message>Your socket connection to the server w (truncated...)
RequestTimeout (client): Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed. - <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>RequestTimeout</Code><Message>Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.</Message><RequestId>AACZMQFEYMMVXB9M</RequestId><HostId>BSya2iGXytSA6ZXGKYEWubGxPUxz9luL/0YVfl4xmTEnwZ+nsW4s3jgSGumkEfaOrpIq9D/nWvE=</HostId></Error>'
GuzzleHttp\Exception\ClientException: Client error: `PUT https://sweb-dgar.s3.eu-central-1.amazonaws.com/2022-08-25-07-18-13/maindb-2022-08-25-07-18-13.sql.gz` resulted in a `400 Bad Request` response:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>RequestTimeout</Code><Message>Your socket connection to the server w (truncated...)
in /home/username/PHPBackupScript/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 /home/username/PHPBackupScript/vendor/guzzlehttp/guzzle/src/Middleware.php(69): GuzzleHttp\Exception\RequestException::create()
#1 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}()
#2 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler()
#3 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 /home/username/PHPBackupScript/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(158): GuzzleHttp\Promise\TaskQueue->run()
#5 /home/username/PHPBackupScript/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(183): GuzzleHttp\Handler\CurlMultiHandler->tick()
#6 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute()
#7 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#8 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#9 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#10 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#11 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#12 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#13 /home/username/PHPBackupScript/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): GuzzleHttp\Promise\Promise->wait()
#14 /home/username/PHPBackupScript/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(86): Aws\AwsClient->execute()
#15 /home/username/PHPBackupScript/backup-s3.php(44): Aws\AwsClient->__call()
#16 {main}
Next Aws\S3\Exception\S3Exception: Error executing "PutObject" on "https://sweb-dgar.s3.eu-central-1.amazonaws.com/2022-08-25-07-18-13/maindb-2022-08-25-07-18-13.sql.gz"; AWS HTTP error: Client error: `PUT https://sweb-dgar.s3.eu-central-1.amazonaws.com/2022-08-25-07-18-13/maindb-2022-08-25-07-18-13.sql.gz` resulted in a `400 Bad Request` response:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>RequestTimeout</Code><Message>Your socket connection to the server w (truncated...)
RequestTimeout (client): Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed. - <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>RequestTimeout</Code><Message>Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.</Message><RequestId>AACZMQFEYMMVXB9M</RequestId><HostId>BSya2iGXytSA6ZXGKYEWubGxPUxz9luL/0YVfl4xmTEnwZ+nsW4s3jgSGumkEfaOrpIq9D/nWvE=</HostId></Error> in /home/username/PHPBackupScript/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php:195
Stack trace:
#0 /home/username/PHPBackupScript/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php(97): Aws\WrappedHttpHandler->parseError()
#1 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(204): Aws\WrappedHttpHandler->Aws\{closure}()
#2 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(169): GuzzleHttp\Promise\Promise::callHandler()
#3 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/RejectedPromise.php(42): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\RejectedPromise::GuzzleHttp\Promise\{closure}()
#5 /home/username/PHPBackupScript/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(158): GuzzleHttp\Promise\TaskQueue->run()
#6 /home/username/PHPBackupScript/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(183): GuzzleHttp\Handler\CurlMultiHandler->tick()
#7 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute()
#8 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#9 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#10 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#11 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#12 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#13 /home/username/PHPBackupScript/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#14 /home/username/PHPBackupScript/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(58): GuzzleHttp\Promise\Promise->wait()
#15 /home/username/PHPBackupScript/vendor/aws/aws-sdk-php/src/AwsClientTrait.php(86): Aws\AwsClient->execute()
#16 /home/username/PHPBackupScript/backup-s3.php(44): Aws\AwsClient->__call()
#17 {main}
thrown in /home/username/PHPBackupScript/vendor/aws/aws-sdk-php/src/WrappedHttpHandler.php on line 195
I've been testing this out but when you untar the directory backup, it is always empty.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.