【问题标题】:Heroku doesn't recognize my Laravel app as PHP app, and does not do composer installHeroku 无法将我的 Laravel 应用程序识别为 PHP 应用程序,并且不执行 composer install
【发布时间】:2015-02-28 17:52:26
【问题描述】:

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

的 Procfile
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 应用程序? 可以肯定的是,我还在我的根目录中包含了一个空的 index.php 文件。没有帮助。

我在这里错过了什么?

【问题讨论】:

    标签: php heroku laravel-4 composer-php


    【解决方案1】:

    我相信我找到了。应该更好地阅读这些行(“检测到 Node.js 应用程序”)。 通过触发此命令解决:

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

    然后再推

    【讨论】:

    • 这对我不起作用。但是heroku buildpacks:set https://github.com/heroku/heroku-buildpack-php 按照this link 工作。
    • 谢谢 Raghuram,上面的方法对我也不起作用,但你提供的命令起作用了 :-)
    【解决方案2】:

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

    【讨论】:

      【解决方案3】:

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

      【讨论】:

        猜你喜欢
        • 2019-03-14
        • 1970-01-01
        • 1970-01-01
        • 2014-06-01
        • 2020-05-12
        • 2014-01-02
        • 1970-01-01
        • 2017-05-19
        • 1970-01-01
        相关资源
        最近更新 更多