我对Heroku设置并不是很好
我试图将应用程序放在PHP中(使用Code Igniter),但它不能很好地运行。这是错误:
Heroku PHP app crash bash: vendor/bin/heroku-php-apache2: No such file or directory
index.php在根文件夹中。供应商目录也在根文件夹中 作曲家完成了他的工作 在procfile中:
web: vendor/bin/heroku-php-apache2
在我的index.php中:
require('vendor/autoload.php');
过去我使用boot.sh的方式,所以我对新方式感到不舒服。 我按照本教程 https://devcenter.heroku.com/articles/getting-started-with-php#introduction
我想我错过了一些明显的东西。但我不知道是什么。 谢谢
答案 0 :(得分:15)
您的composer.json
可能会将bin-dir
设置重新定义为vendor/bin
以外的其他设置。运行composer config bin-dir
查看它是什么(或查看composer.json
的{{1}}部分,并调整config
中heroku-php-apache2
的路径相应
您也可以更改Procfile
以自动阅读正确的值:
Procfile
https://devcenter.heroku.com/articles/php-support#web-servers的注释也提到了web: $(composer config bin-dir)/heroku-php-apache2
警告。
答案 1 :(得分:3)
我的解决方案是将以下代码添加到composer.json
。
"require-dev": {
"heroku/heroku-buildpack-php" : "dev-master"
}
然后运行composer update
。
答案 2 :(得分:0)
您是否尝试删除procfile并添加base composer.json
答案 3 :(得分:0)
感谢大卫,答案是:
您正在使用buildpack的旧版本 - 您的应用已将BUILDPACK_URL设置为https://github.com/heroku/heroku-buildpack-php.git#legacy。 运行heroku config:取消设置BUILDPACK_URL并推送一个空的更改(git commit -m“new buildpack” - allow-empty就可以了。)
因为我使用boot.sh从旧项目(> 1年)复制/粘贴旧变量
BUILDPACK_URL是错误的网址。现在不用说了。
谢谢dzuelke!
答案 4 :(得分:0)
除了完全按照此处描述的步骤操作外:
https://devcenter.heroku.com/articles/getting-started-with-laravel
我不得不从gitignore删除.env并设置
使用
生成APP_KEYphp artisan key:generate --show
到.env
为了使其发挥作用。