0

Im interested in learning to use Amazon S3 PHP SDK and see references to 'installing' it (as opposed to it just being a series of files that I just upload to my hosting account and use) and all the tutorials seem to indicate I have to have command line access to the server.

Im using dreamhost and have a shared hosting account and would like to know: How do I go about 'installing' the sdk if I dont have access to the command line for the dreamhost account?

Im fairly new to PHP specifically but have experience with other languages and general programming principals (as3, vbscript, javascript, .asp, etc.)

I've managed to hobble together the following using some PHP-based (non AWS PHP SDK) routines others have shared online... so I currently have the following working great:

  • upload capability that allows my authorized user to upload files to a bucket successfully (using DIRECT UPLOAD TO S3)

  • bucket listing capability (getting files in a bucket as JSON that I'll consume and display in UI (using aws-s3-bucket-listing)

... the LAST critical missing piece is the ability to DELETE a file from a bucket.

I cant find where anyone has examples of doing this WITHOUT using the AWS sdks and decided to revisit the idea of using what seems to be a very powerful and robust sdk. It may be that given my limited experience with PHP that its just out of my league, but thats never stopped me before I guess!

Thanks for any light anyone can shed that can get me going in the right direction.

tamak
  • 1,541
  • 2
  • 19
  • 39
  • I assume you can download it locally and FTP it into your shared environment. That said, a Digital Ocean droplet will cost you as low as $5 a month if you want cli access... – Darragh Enright Mar 25 '15 at 22:17
  • They have a REST API, so all you need to do it make an HTTP DELETE request with the right parameters … that requires no SDK. http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectDELETE.html – CBroe Mar 25 '15 at 22:20
  • You can just download the phar file and save it to your server. Voila, you've installed the sdk :). I have done it on several hosts. No problems. – Robbert Mar 25 '15 at 22:31

1 Answers1

2

The PHP AWS SDK is a composer based project. This means the best way to install it is to use composer via a ssh connection. It's been over a decade since I used Dreamhost, but their shared accounts should have SSH access.

If that's not an option, use the require string

{
    "require": {
        "aws/aws-sdk-php": "2.*"
    }
}

to find the project on packagist.

The packagist page will point to the project's GitHub repository. If you look at the GitHub releases, you'll see a number of downloads, including a zip download. This download appears to have its own aws-autoloader.php file, so require that and you should be off to the races.

Alana Storm
  • 164,128
  • 91
  • 395
  • 599