在Heroku上部署PHP应用程序的问题

时间:2019-12-21 17:04:23

标签: php heroku deployment

我正在尝试通过Github在Heroku上部署Php应用程序,这是我的大学Web工程模块的要求,但我收到以下错误消息:

ERROR: Application not supported by this buildpack!
 !     
 !     The 'heroku/php' buildpack is set on this application, but was
 !     unable to detect a PHP codebase.
 !     
 !     A PHP app on Heroku requires a 'composer.json' at the root of
 !     the directory structure, or an 'index.php' for legacy behavior.
 !     
 !     If you are trying to deploy a PHP application, ensure that one
 !     of these files is present at the top level directory.
 !     
 !     If you are trying to deploy an application written in another
 !     language, you need to change the list of buildpacks set on your
 !     Heroku app using the 'heroku buildpacks' command.
 !     
 !     For more information, refer to the following documentation:
 !     https://devcenter.heroku.com/articles/buildpacks
 !     https://devcenter.heroku.com/articles/php-support#activation
       More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
 !     Push failed

enter image description here

content of the view folder

目前,我的应用程序包含在两个文件夹中。 第二张图像显示视图文件夹的内容。

我的猜测是体系结构不足以在heroku上进行部署,但是我不知道如何解决此问题。我试图将主页重命名为index.php,但是当然这不是解决方案。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

按照它告诉你的做。您可以添加composer.json来定义依赖关系。 index.php需要/。因此,也许您应该添加一个并重定向到/view/homepage.php

也许您也想要Procfile上的/,就像这样:

web: vendor/bin/heroku-php-apache2 view/

如果这样做,则/index.php不是必需的,但请确保其中有/view/index.php