Heroku 无法将我的 Laravel 应用程序识别为 PHP 应用程序,并且不进行作曲家安装


Heroku doesn't recognize my Laravel app as PHP app, and does not do composer install

我正在尝试在Heroku上发布我的Laravel应用程序。我已经从 .gitignore 中排除了 composer.lock 文件,并创建了一个包含

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

我创建了我的应用

heroku create myapp;
git push heroku master;

然后我得到以下输出:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree push -v --tags heroku master:master 
Pushing to https://git.heroku.com/myapp.git
POST git-receive-pack (1914 bytes)
remote: Compressing source files... done.        
remote: Building source:        
remote: 
remote: -----> Node.js app detected        
remote: -----> Resetting git environment        
remote: 
remote:        PRO TIP: Specify a node version in package.json        
remote:        See https://devcenter.heroku.com/articles/nodejs-support        
remote: 
remote: -----> Defaulting to latest stable node: 0.10.35        
remote: -----> Downloading and installing node        
remote: -----> Exporting config vars to environment        
remote: -----> Installing dependencies        
remote:        npm WARN package.json myapp@0.0.0 No repository field.        
remote: -----> Cleaning up node-gyp and npm artifacts        
remote: -----> Building runtime environment        
remote: -----> Discovering process types        
remote:        Procfile declares types -> web        
remote: 
remote: -----> Compressing... done, 9.6MB        
remote: -----> Launching... done, v5        
remote:        https://myapp.herokuapp.com/ deployed to Heroku        
remote: 
remote: Verifying deploy... done.        
To https://git.heroku.com/myapp.git
   5b1c663..0dff021  master -> master
updating local tracking ref 'refs/remotes/heroku/master'
Completed successfully

但是,如果我浏览到我的应用程序,则会收到应用程序错误。当我查看我的日志时,它说

app[web.1]: bash: vendor/bin/heroku-php-apache2: No such file or directory

我怀疑不知何故,Heroku 没有进行作曲家安装,因为它不在我的 git 输出中,也许它甚至没有识别出我的应用程序是 PHP 应用程序?可以肯定的是,我还在我的根目录中包含一个空的索引.php文件。没帮助。

我在这里错过了什么?

我相信

我找到了。应该更好地阅读行("检测到节点.js应用程序")。通过触发此命令解决:

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

并再次推动

哈哈,只需将package.json放在您的 laravel 项目中即可。然后 Heroku 会将您的应用程序检测为 php 项目。

请务必在 publicpublic/ 中包含尾部斜杠。这是我的问题 - 我正在使用Laravel并得到了一个Image source not readableNotReadableException in AbstractDecoder.php line 302:,因为它认为at AbstractDecoder->init('/app/public') in AbstractDriver.php line 64是一个文件,而不是一个文件夹。