I'm trying to publish my Laravel app on Heroku. I have excluded the composer.lock file from .gitignore, and created a Procfile containing
web: vendor/bin/heroku-php-apache2 public
I created my app with
heroku create myapp;
git push heroku master;
Then I get the following output:
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags heroku master:master
Pushing to https://git.heroku.com/myapp.git
POST git-receive-pack (1914 bytes)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote: -----> Resetting git environment
remote:
remote: PRO TIP: Specify a node version in package.json
remote: See https://devcenter.heroku.com/articles/nodejs-support
remote:
remote: -----> Defaulting to latest stable node: 0.10.35
remote: -----> Downloading and installing node
remote: -----> Exporting config vars to environment
remote: -----> Installing dependencies
remote: npm WARN package.json [email protected] No repository field.
remote: -----> Cleaning up node-gyp and npm artifacts
remote: -----> Building runtime environment
remote: -----> Discovering process types
remote: Procfile declares types -> web
remote:
remote: -----> Compressing... done, 9.6MB
remote: -----> Launching... done, v5
remote: https://myapp.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/myapp.git
5b1c663..0dff021 master -> master
updating local tracking ref 'refs/remotes/heroku/master'
Completed successfully
If I browse to my app, however I get an application error. When I look to my logs, it says
app[web.1]: bash: vendor/bin/heroku-php-apache2: No such file or directory
I suspect that somehow, Heroku didn't do composer install, as it's not in my git output, and maybe it didn't even recognize that my app is an PHP app? To be sure, I also included an empty index.php file in my root. Didn't help.
What am I missing here?
Heroku's PHP support extends to applications using the latest available releases in the PHP 7.4, PHP 8.0 and PHP 8.1 series.
Haha, just simply drop the package.json
in your laravel project.
And then Heroku will detect your app as a php project.
I believe I found it. Should better read the lines ("Node.js app detected"). Solved by firing this command :
heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php
and pushing again
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With