Abhishek Jain
Abhishek Jain

Reputation: 991

How do i run s3cmd from PHP?

How do i run s3cmd from PHP. What i am trying to do is backup certain files on s3 and will be storing its public url in database. $result = shell_exec("s3cmd put --skip-existing --acl-public /var/www/RD/temp.txt s3://xxxx/xxx/xx/");

However when i run the .php file .. nothing happens..

I have gone through the link mentioned below, but it didnt work for me. https://serverfault.com/questions/91443/why-shell-command-runs-from-command-line-but-not-from-php-script

Abhishek Jain

Upvotes: 2

Views: 3141

Answers (2)

SkippyFlipjack
SkippyFlipjack

Reputation: 522

This failed for me with no error until I used the full path:

exec('/usr/local/bin/s3cmd --access-key=ZZZZZ --secret-key=XXXXX put /Users/me/filename.jpg s3://bucketname/foldername/'); 

Upvotes: 2

Sid
Sid

Reputation: 2156

Why not instead use a proper PHP S3 library? Take a look at http://code.google.com/p/amazon-s3-php-class/

Upvotes: 1

Related Questions