将laravel应用程序部署到heroku

时间:2018-02-07 06:48:27

标签: laravel heroku

我正在测试如何将laravel应用程序部署到heroku,所以我只是在laravel中创建了一个简单的应用程序,并遵循本指南https://devcenter.heroku.com/articles/getting-started-with-laravel

起初我有一个问题,heroku没有认识到我的应用程序是一个php应用程序所以我添加了一个大部分为空的package.json,以便heroku按照本指南https://github.com/heroku/heroku-buildpack-php

中的说明检测它

现在它检测到它但仍然无法部署并显示此错误:

Counting objects: 127, done.
Delta compression using up to 4 threads. 
Compressing objects: 100% (107/107), done.
Writing objects: 100% (127/127), 236.46 KiB | 0 bytes/s, done.
Total 127 (delta 14), reused 0 (delta 0) 
remote: Compressing source files... done. 
remote: Building source: 
remote:  
remote: -----> PHP app detected 
remote: -----> Bootstrapping... 
remote: -----> Installing platform packages... 
remote:  
remote:  !     ERROR: Failed to install system packages. 
remote:         
remote:        Your platform requirements (for runtimes and extensions) could 
remote:        not be resolved to an installable set of dependencies, or a             
remote:        repository was unreachable. 
remote:         
remote:        Full error information from installation attempt: 
remote:         
remote:        > Loading repositories with available runtimes and extensions 
remote:        >  
remote:        >                                                               
remote:        >   [Composer\Downloader\TransportException]            
remote:        >   The 'https://mybucket.s3.amazonaws.com/cedar-14/packages.json' URL could not be accessed: HTTP/1.1 403 Forbidden   
remote:        >             
remote:        >  
remote:        > install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]... 
remote:        >  
remote:         
remote:        Please verify that all requirements for runtime versions in     
remote:        'composer.lock' are compatible with the list below, and ensure 
remote:        all required extensions are available for the desired runtimes. 
remote:         
remote:        For reference, the following runtimes are currently available: 
remote:         
remote:        PHP:   
remote:        HHVM:  
remote:         
remote:        For a list of supported runtimes & extensions on Heroku, please 
remote:        refer to: https://devcenter.heroku.com/articles/php-support     
remote:  
remote:  !  Push rejected, failed to compile PHP app. 
remote:  
remote:  !     Push failed 
remote: Verifying deploy... 
remote:  
remote: !   Push rejected to nameless-peak-52308. 
remote:  To https://git.heroku.com/nameless-peak-52308.git  
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/nameless-peak-52308.git'

3 个答案:

答案 0 :(得分:1)

我通过配置heroku解决了这个问题:

   heroku config:set HEROKU_PHP_PLATFORM_REPOSITORIES="https://heroku-v8js.s3.amazonaws.com/dist-cedar-14-stable/packages.json"

https://github.com/phpv8/heroku-v8js

解释

答案 1 :(得分:0)

无法访问

'https://mybucket.s3.amazonaws.com/cedar-14/packages.json'网址:HTTP / 1.1 403 Forbidden

这意味着您需要在AWS中为此文件/文件夹设置public的权限。我猜你已经登录了,你可以很好地访问它,但是由于权限,Heroku无法查看它。

答案 2 :(得分:0)

可以由作曲家使用composer update,然后使用git add .添加,然后使用git push heroku master将其上传到heroku服务器