简体   繁体   中英

How to fix Heroku not recognizing my PHP webapplication that I want to deploy

I developed a PHP application: just a index.php with several links to other PHP files. We are gonna make a Progressive Web App (PWA) out of it. I want to test it on several Android devices for which I need a publicly accessible URL. I want to use Heroku to do that.

I've set Heroku CLI and everything works except deployment. When I want to deploy, Heroku gives me an error message saying that the application is not supported by this buildpack. When I clear the buildpacks, the automatic-buildpack-assign flow doesn't work because Heroku doesn't recognize a language.

ERROR: Application not supported by this buildpack!
remote:  !
remote:  !     The 'heroku/php' buildpack is set on this application, but was
remote:  !     unable to detect a PHP codebase.
remote:  !
remote:  !     A PHP app on Heroku requires a 'composer.json' at the root of
remote:  !     the directory structure, or an 'index.php' for legacy behavior.
remote:  !
remote:  !     If you are trying to deploy a PHP application, ensure that one
remote:  !     of these files is present at the top level directory.
remote:  !
remote:  !     If you are trying to deploy an application written in another
remote:  !     language, you need to change the list of buildpacks set on your
remote:  !     Heroku app using the 'heroku buildpacks' command. 

However: I've setup an - empty - composer.json especially for Heroku AND I already had an index.php .

I can't figure out what is still going wrong.

Already made a composer.json file and composer.lock to accomodate the issues Heroku is outlining in the error message.

Turns out I wasn't fully understanding my git push command.

I was commanding: git push heroku master . My thought: my current branch is being pushed to Heroku's master branch. That seemed to be not true. In reality: git push heroku master means that you push your local master to the remote master's. And my local master was empty..

So, I changed my command to git push heroku dev:master to specify which local branch should go to the remote's branch. Not a best practice but it's a test app so a good solution for now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM