当前位置: 动力学知识库 > 问答 > 编程问答 >

zend framework - executing s3cmd using PHP exec()

问题描述:

I'm writing a mysql backup script which does a database backup and upload the backup into amazon s3 bucket.

I'm using exec() to run mysqldump, tar & gzip the backup. so far it was pretty straightforward. Now I have some issues with uploading the backup to amazon S3.

As far as I read, s3cmd requires a .s3cfg file with amazon's access_key & secret_key credentials. I don't want to rely on these settings in a separated config file, and I already have the amazon credentials in a PHP config file.

Is there a way to execute s3cmd and directly entering the keys into the command line? Something like:

s3cmd cp --access=KEY -secret=KEY /tmp/backup.tar.gz s3://backups/....

I don't want use the Zend_Cloud_StorageService_Adapter_S3. I understand this library has to read the entire file into the PHP memory and then send it. These backups will be huge and I prefer using exec(), which is much faster.

分享给朋友:
您可能感兴趣的文章:
随机阅读: