0

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

2 Answers2

0

So looks like an include can not find vendor/autoload.php

Are you sure that it exists?

vendor folder should be in fb folder an have that file. Remember it is case sensitive.

  1. Just make sure that you point to proper file on an include.
  2. Make sure you ran composer install
E_p
  • 3,136
  • 16
  • 28
0

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?

dzuelke
  • 2,645
  • 15
  • 16
  • I'm sort of a newbie developer, only coding since 2009 and only with as3, php, c#, .net. The app requires the facebook graph api and i'm not exactly sure how to run the app locally. Anyways, I need to somehow run composer update on my heroku dyno – Ricky Mossip Feb 28 '15 at 00:12
  • No you don't. Like I said, you run `composer update` locally, so your dependency versions are frozen to a known and reproducible state in `composer.lock`. That's the whole point of dependency management. You then check in the changed `composer.json` and `composer.lock`, and push that to Heroku, it will install the dependencies for you. – dzuelke Feb 28 '15 at 14:14
  • And of course if you want to include the autoloader from inside the `fb/` subfolder of your application, then you need to `require('../vendor/autoload.php');`, or better yet, `require(__DIR__.'/../vendor/autoload.php');`... – dzuelke Feb 28 '15 at 14:16
  • why does my .gitignore file contain the vender directory? do i have to remove that so the libs get transferred to the server on my next push? – Ricky Mossip Mar 01 '15 at 13:28
  • No. The `vendor/` directory contains the dependencies' source code. The whole point of Composer, Bundler, NPM etc is that you do *not* check in the dependency sources, only the "declaration", which is `composer.json` (what you "require") and `composer.lock` (a "frozen" state from when you last ran `composer update`, so you, your co-developers, Heroku etc always install the exact same dependencies on each `composer install` or deploy, and not new versions some day that break things). Just follow the instructions I gave you and Heroku will install the AWS SDK. – dzuelke Mar 02 '15 at 14:20