Search code examples
phpherokuamazon-web-servicesheroku-toolbeltaws-php-sdk

How do i upload to amazon s3 using Heroku composer amazon aws sdk


I'm using heroku and i'm following this tutorial here, https://devcenter.heroku.com/articles/s3-upload-php

I have placed the composer require line in my composer.json file as shown below.

{ "require" : { "silex/silex": "~1.1", "monolog/monolog": "~1.7" }, "require-dev": { "heroku/heroku-buildpack-php": "*" }, "require" : { "aws/aws-sdk-php": "~2.6" } }

As you can see i placed the amazon one last. However, i'm receiving the following error message.

2015-02-27T16:26:05.499004+00:00 app[web.1]: [27-Feb-2015 16:26:05 UTC] PHP Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in /app/web/fb/fileupload.php on line 4

Does anyone know if i have to do anything other than place that line in my composer json file???? please help


Solution

  • You now have two "require" keys, how is that supposed to work? It's a hash map, the keys overwrite each other!

    This is what you want:

    {
      "require": {
        "silex/silex": "~1.1",
        "monolog/monolog": "~1.7",
        "aws/aws-sdk-php": "~2.6"
      },
      "require-dev": {
        "heroku/heroku-buildpack-php": "*"
      }
    }
    

    And then you of course have to run composer update to generate a composer.lock, and check that into the repos along with the rest of your code.

    Why don't you run the app locally on your computer before pushing it up to Heroku?