13

I'm not very good with Heroku setup

I'm trying to put online an app in PHP (with Code Igniter) but it doesn't work well. Here is the error :

Heroku PHP app crash bash: vendor/bin/heroku-php-apache2: No such file or directory 

index.php is in root folder. Vendor directory also in root folder composer made his job In procfile :

web: vendor/bin/heroku-php-apache2

And in my index.php:

require('vendor/autoload.php');

In the past I used the boot.sh way, so I'm not comfortable with the new way. I followed this tutorial https://devcenter.heroku.com/articles/getting-started-with-php#introduction

I think I missed something obvious. But I don't know what. Thank you

1
  • wanted to ask, where did you write this require('vendor/autoload.php'); ?? I opened the index.php file but there doesnt seem like a place to write this Commented Feb 6, 2016 at 22:43

5 Answers 5

22

Your composer.json likely re-defines the bin-dir setting to something other than vendor/bin. Run composer config bin-dir to see what it is (or look at your composer.json's config section, and adjust the path to heroku-php-apache2 in your Procfile accordingly.

You can also just change the Procfile to automatically read the right value:

web: $(composer config bin-dir)/heroku-php-apache2

The notes at https://devcenter.heroku.com/articles/php-support#web-servers also mention this bin-dir caveat.

Sign up to request clarification or add additional context in comments.

3 Comments

Thank you but the bin-dir is already set to : ➜ app git:(master) composer config bin-dir vendor/bin there is nothing more in composer than this : { "require" : { "rfd/imagemagick": "~1.1" }, "require-dev": { "heroku/heroku-buildpack-php": "*" } }
And heroku config doesn't show a BUILDPACK_URL, right? If it does, you're using some other (likely third party) buildpack... so remove it and push again.
The web: $(composer config bin-dir)/heroku-php-apache2 public/ command execution works particularly well. Even though when I executed the composer config bin-dir command I received vendor/bin, my app was repetitively crashing. But then I updated the Procfile with the above command and all worked like magic. This was probably because my .gitignore file contained /vendor in it, I'm not sure though. Any idea?
5

My solution was to add the code below to composer.json.

"require-dev": {
    "heroku/heroku-buildpack-php" : "dev-master"
}

Then run composer update.

Comments

1

Did you try to remove your procfile and add the base composer.json

Comments

1

Thanks To David, here is the answer :

You're using the legacy version of the buildpack - your app has BUILDPACK_URL set to https://github.com/heroku/heroku-buildpack-php.git#legacy. Run heroku config:unset BUILDPACK_URL and push an empty change (git commit -m "new buildpack" --allow-empty will do).

Because I Copy/pasted old vars from an old project (> 1 year) using boot.sh

There was BUILDPACK_URL which was the bad URL. No need to put it now.

Thanks dzuelke !

Comments

0

In addition to following the steps exactly as described here :

https://devcenter.heroku.com/articles/getting-started-with-laravel

I had to remove .env from gitignore and also set

APP_KEY generated using

php artisan key:generate --show

to .env

in order for this to work.

2 Comments

For your app key I get output like base64:XXXXXXXXXX=. Do you include the "base64:" portion in you .env file?
@ConnorLeech Yes, you do include the "base64:" portion. This feature lets us store an application key with special characters inside the .env file. Laravel decodes it when reading the value of the key.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.