I need to add S3 capabilities in my PHP application. I also need to manually upload files from the command line into the S3 account.
It would be best, of course, for me to use S3fm within PHP, but I’m wondering if I should be calling S3cmd from my php script – just to avoid having two tools doing the same thing.
If this Q doesn’t belong here, please feel free to bump it to serverfault.com ( / elsewhere)?
You can launch s3cmd by different ways from php:
http://ru.php.net/manual/en/function.system.php
<?php system("/path/to/s3cmd"); ?>http://ru.php.net/manual/en/function.exec.php
<?php exec("/path/to/s3cmd"); ?>http://ru.php.net/manual/en/function.passthru.php
<?php passthru("/path/to/s3cmd"); ?>http://ru.php.net/manual/en/function.popen.php
<?php $handle = popen("/path/to/s3cmd", "r"); ?>If you do simple file unload using http://ru.php.net/manual/en/function.move-uploaded-file.php
you will solve your problem.
good luck!