我不太擅长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
我想我错过了一些显而易见的东西。但我不知道是什么。感谢
您的composer.json
可能会将bin-dir
设置重新定义为vendor/bin
以外的内容。运行composer config bin-dir
查看它是什么(或者查看composer.json
的config
部分,并相应地调整Procfile
中heroku-php-apache2
的路径。
您也可以更改Procfile
以自动读取正确的值:
web: $(composer config bin-dir)/heroku-php-apache2
上的注释https://devcenter.heroku.com/articles/php-support#web-服务器也提到了这个bin-dir
警告。
我的解决方案是将下面的代码添加到composer.json
中。
"require-dev": {
"heroku/heroku-buildpack-php" : "dev-master"
}
然后运行composer update
。
您是否尝试删除procfile并添加基本composer.json
感谢David,以下是答案:
您使用的是buildpack的旧版本-您的应用程序的buildpack_URL设置为https://github.com/heroku/heroku-buildpack-php.git#legacy.运行heroku-config:unset BUILDAPACK_URL并推送一个空更改(gitcommit-m"new BUILDPACK"--allow empty即可(。
因为我使用boot.sh 从旧项目(>1年(复制/粘贴旧的变量
BUILDAPACK_URL是错误的URL。现在不用放了。
谢谢dzuelke!
除了遵循此处所述的步骤外:
https://devcenter.heroku.com/articles/getting-started-with-laravel
我不得不从gitignore中删除.env,并设置
使用生成APP_KEY
php artisan密钥:生成-显示
至.env
为了使其发挥作用。