简体   繁体   English

我无法将我的 php 应用程序部署到 Heroku

[英]I can't deploy my php app to Heroku

This is the first time I get in touch with Heroku (it's really amazing).这是我第一次接触到 Heroku(真的很神奇)。 I followed these steps to deploy my very first app to heroku.我按照以下步骤将我的第一个应用程序部署到 heroku。

git init
git add .
git commit -m 'first commit'
heroku create abcfirstapp
git remote add origin git@heroku.com:abcfirstapp.git
git push heroku master

And I got the error like我得到了这样的错误

Heroku push rejected, no Cedar--supported app detected To git@heroku.com:abcfirstapp.git [remote.rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'git@heroku.com:abcfirstapp.git' Heroku推送被拒绝,没有检测到Cedar--supported app To git@heroku.com:abcfirstapp.git [remote.rejected] master -> master (pre-receive hook denied) error: failed to push some refs to 'git@heroku. com:abcfirstapp.git'

I'm quite sure that my php file is written probably since it runs well with my local xampp server我很确定我的 php 文件可能是写的,因为它在我的本地 xampp 服务器上运行良好

<?PHP phpinfo(); ?>

One more problem is: when I try to pull from heroku using还有一个问题是:当我尝试从 heroku 中提取时使用

git pull heroku master

I got an error我有一个错误

fatal: couldn't find remote ref master致命:找不到远程参考主

Could anyone help me out please?有人可以帮我吗?

Thanks谢谢

The default PHP buildpack detects PHP apps by looking for index.php in the repo root.默认的 PHP buildpack 通过在 repo 根目录中查找index.php来检测 PHP 应用程序。 Do you have one of those?你有其中之一吗?

Alternatively, you can hardcode the buildpack:或者,您可以对 buildpack 进行硬编码:

heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-php

no Cedar--supported app detected没有检测到雪松-支持的应用程序

PHP is not a natively supported language on Heroku, outside of Facebook apps I suppose. PHP 不是 Heroku 上原生支持的语言,我想是在 Facebook 应用程序之外。 You'll need to utilize something like a Third Party Buildpack .您需要使用第三方 Buildpack 之类的东西。

It looks like the docs (Apr 2015) recommend you set a custom buildpack via:看起来文档(2015 年 4 月)建议您通过以下方式设置自定义 buildpack:

heroku buildpack:set https://github.com/heroku/heroku-buildpack-php

https://devcenter.heroku.com/articles/buildpacks https://devcenter.heroku.com/articles/buildpacks

需要的是至少一个空的composer.json推送这个,然后重新部署

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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