将PHP Laravel 4.2部署到Heroku失败

时间:2016-02-09 10:03:50

标签: php laravel heroku laravel-4

我有一个简单的Laravel 4.2应用程序可以在我当地的Homestead机器上运行。我正在使用VirtualBox运行OSX Yosemite。

但我无法将其部署到Heroku。我有一个基本的Procfile:

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

我还使用

设置了我的构建包
heroku buildpacks:set heroku/php

这是我从mac终端运行以下命令时得到的输出:

git push heroku master

输出:

Counting objects: 4305, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4100/4100), done.
Writing objects: 100% (4305/4305), 4.18 MiB | 93.00 KiB/s, done.
Total 4305 (delta 1298), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Using set buildpack heroku/php
remote: -----> PHP app detected
remote: -----> Bootstrapping...
remote: -----> Installing system packages...
remote:        NOTICE: No runtime required in composer.json; requirements
remote:        from dependencies in composer.lock will be used for selection
remote:        - php (7.0.3)
remote:        - Apache (2.4.16)
remote:        - Nginx (1.8.0)
remote: -----> Enabling PHP extensions...
remote:        - ext-zend-opcache (automatic)
remote: -----> Installing dependencies...
remote:        Composer version 1.0.0-alpha11 2015-11-14 16:21:07
remote:        Loading composer repositories with package information
remote:        Installing dependencies from lock file
remote:          - Installing guzzlehttp/streams (2.1.0)
remote:            Downloading: 100%
remote:        
remote:          - Installing guzzlehttp/guzzle (4.2.3)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/translation (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/security-core (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/routing (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/process (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/http-foundation (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/event-dispatcher (v2.8.2)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/debug (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing psr/log (1.0.0)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/http-kernel (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/finder (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/dom-crawler (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/css-selector (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/console (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/browser-kit (v2.5.12)
remote:            Downloading: 100%
remote:        
remote:          - Installing swiftmailer/swiftmailer (v5.4.1)
remote:            Downloading: 100%
remote:        
remote:          - Installing stack/builder (v1.0.3)
remote:            Downloading: 100%
remote:        
remote:          - Installing predis/predis (v0.8.7)
remote:            Downloading: 100%
remote:        
remote:          - Installing phpseclib/phpseclib (0.3.10)
remote:            Downloading: 100%
remote:        
remote:          - Installing patchwork/utf8 (v1.3.0)
remote:            Downloading: 100%
remote:        
remote:          - Installing nesbot/carbon (1.17.0)
remote:            Downloading: 100%
remote:        
remote:          - Installing monolog/monolog (1.17.2)
remote:            Downloading: 100%
remote:        
remote:          - Installing nikic/php-parser (v0.9.5)
remote:            Downloading: 100%
remote:        
remote:          - Installing jeremeamia/superclosure (1.0.2)
remote:            Downloading: 100%
remote:        
remote:          - Installing ircmaxell/password-compat (v1.0.4)
remote:            Downloading: 100%
remote:        
remote:          - Installing filp/whoops (1.1.10)
remote:            Downloading: 100%
remote:        
remote:          - Installing d11wtq/boris (v1.0.8)
remote:            Downloading: 100%
remote:        
remote:          - Installing symfony/filesystem (v2.8.2)
remote:            Downloading: 100%
remote:        
remote:          - Installing classpreloader/classpreloader (1.0.2)
remote:            Downloading: 100%
remote:        
remote:          - Installing laravel/framework (v4.2.19)
remote:            Downloading: 100%
remote:        
remote:        Generating optimized autoload files
remote:        > php artisan clear-compiled
remote:        Mcrypt PHP extension required.
remote:        Script php artisan clear-compiled handling the post-install-cmd event returned with an error
remote:        
remote:        
remote:                              
remote:          [RuntimeException]  
remote:          Error Output:       
remote:                              
remote:        
remote:        
remote:        install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...
remote:        
remote:        
remote: 
remote:  !     Push rejected, failed to compile PHP app
remote: 
remote: Verifying deploy....
remote: 
remote: !   Push rejected to agile-wildwood-99938.
remote: 
To https://git.heroku.com/agile-wildwood-99938.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/agile-wildwood-     99938.git'

当我运行时(从我的laravel项目根文件夹)

,它值得注意我的本地机器
php artisan

我收到类似于Heroku部署输出的消息,即

Mcrypt PHP extension required.

我不知道这是否相关?可能在我的本地机器上没有Mcrypt影响Heroku部署,还是Heroku输出完全指向Heroku服务器?

我在这里苦苦挣扎。希望得到一些帮助。

谢天谢地 查理

1 个答案:

答案 0 :(得分:2)

如果您的应用需要MCrypt扩展程序,则需要通过将exr-mcrypt作为要求添加到composer.json来启用它。见https://devcenter.heroku.com/articles/php-support#extensions