Heroku PHP文档根问题

时间:2019-02-26 17:04:32

标签: php heroku

我在heroku上有一个PHP应用程序,由于以下存储库结构,该应用程序没有出现问题:

myapp
├── connect.php
├── elec.php
├── index.php
└── key.php

我将应用程序克隆到了另一台计算机上,并按如下所示重新组织了该应用程序:

myapp
├── auth-server
│   ├── composer.json
│   ├── connect.php
│   ├── election.php
│   ├── index.php
│   └── key.php
├── poll-server
└── Procfile

Procfile包含以下内容:

  

网络:vendor / bin / heroku-php-apache2 auth-server /

但是,部署失败并显示以下消息:

Enumerating objects: 35, done.
Counting objects: 100% (35/35), done.
Delta compression using up to 4 threads
Compressing objects: 100% (29/29), done.
Writing objects: 100% (34/34), 58.78 KiB | 2.35 MiB/s, done.
Total 34 (delta 7), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/php.tgz
remote:
remote:  !     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.
remote:  !
remote:  !     For more information, refer to the following documentation:
remote:  !     https://devcenter.heroku.com/articles/buildpacks
remote:  !     https://devcenter.heroku.com/articles/php-support#activation
remote:
remote:
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to myapp.
remote:
To https://git.heroku.com/myapp.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/myapp.git'

由于我在Procfile指定的文档根目录中同时拥有index.php和composer.json,因此错误消息似乎无法提供有关缺失内容的准确信息。

此外,我检查了在先前计算机(也是当前部署的版本)上工作的提交,但发现它现在失败,并显示与上述相同的消息。

2 个答案:

答案 0 :(得分:0)

https://github.com/heroku/heroku-buildpack-php/issues/326#issuecomment-467557798 开发人员回答了我在官方GitHub存储库上创建的问题。

答案 1 :(得分:0)

确保使用 vi 命令将 php 写入文件中,以用于 composer.json 并克隆 php-getting-started git 存储库以防万一。