[英]How to fix Heroku not recognizing my PHP webapplication that I want to deploy
我開發了一個PHP應用程序:只是一個index.php,其中包含指向其他PHP文件的多個鏈接。 我們將使用它開發一個漸進式Web應用程序(PWA)。 我想在一些需要公開訪問URL的Android設備上進行測試。 我想用Heroku做到這一點。
我已經設置了Heroku CLI,除了部署之外,其他所有功能都可以使用。 當我要部署時,Heroku給我一條錯誤消息,指出該buildpack不支持該應用程序。 當我清除構建包時,自動構建包分配流程不起作用,因為Heroku無法識別語言。
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.
但是:我已經為Heroku設置了一個-empty- composer.json
,並且我已經有了一個index.php
。
我不知道哪里出了問題。
已經制作了一個composer.json
文件和composer.lock
來適應Heroku在錯誤消息中概述的問題。
原來我還沒有完全理解我的git push命令。
我正在命令: git push heroku master
。 我的想法是:我當前的分支正被推送到Heroku的主分支。 這似乎是不正確的。 實際上: git push heroku master
意味着您將本地master推送到遠程master。 我當地的master
是空的。
因此,我將命令更改為git push heroku dev:master
以指定應將哪個本地分支轉到遠程分支。 這不是最佳實踐,但它是一個測試應用程序,因此是一個不錯的解決方案。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.