在Heroku上部署Symfony2应用程序


Deploying Symfony2 Application on Heroku

我正试图在heroku上部署symfony2应用程序,但我一直收到这个错误:

-----> PHP app detected
-----> Resolved composer.lock requirement for PHP >=5.3.3 to version 5.6.2.
-----> Installing system packages...
       - PHP 5.6.2
       - Apache 2.4.10
       - Nginx 1.6.0
-----> Installing PHP extensions...
       - zend-opcache (automatic; bundled, using 'ext-zend-opcache.ini')
-----> Installing dependencies...
       Composer version 1.0-dev (ffffab37a294f3383c812d0329623f0a4ba45387) 2014-11-05 06:04:18
       Loading composer repositories with package information
       Installing dependencies from lock file
       Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
         - Installing doctrine/lexer (v1.0)
           Downloading: connection...    Downloading: 0%               Downloading: 80%    Downloading: 100%
     - Installing doctrine/annotations (v1.2.1)
       Downloading: connection...    Downloading: 0%               Downloading: 10%    Downloading: 15%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 55%    Downloading: 65%    Downloading: 70%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%
     - Installing doctrine/cache (v1.3.1)
       Downloading: connection...    Downloading: 0%               Downloading: 20%    Downloading: 25%    Downloading: 40%    Downloading: 45%    Downloading: 65%    Downloading: 90%    Downloading: 95%    Downloading: 100%
     - Installing doctrine/inflector (v1.0)
       Downloading: connection...    Downloading: 0%               Downloading: 55%    Downloading: 100%
     - Installing doctrine/collections (v1.2)
       Downloading: connection...    Downloading: 0%               Downloading: 35%    Downloading: 70%    Downloading: 100%
     - Installing doctrine/common (v2.4.2)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%
     - Installing doctrine/data-fixtures (dev-master ac36ccc)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 100%
     - Installing twig/twig (v1.16.2)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%    Downloading: 100%
     - Installing psr/log (1.0.0)
       Downloading: connection...    Downloading: 0%               Downloading: 15%    Downloading: 30%    Downloading: 45%    Downloading: 60%    Downloading: 75%    Downloading: 100%
     - Installing symfony/symfony (v2.5.6)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%    Downloading: 100%
     - Installing jdorn/sql-formatter (v1.2.17)
       Downloading: connection...    Downloading: 0%               Downloading: 10%    Downloading: 35%    Downloading: 45%    Downloading: 80%    Downloading: 95%    Downloading: 100%
     - Installing doctrine/dbal (v2.4.3)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%    Downloading: 100%
     - Installing doctrine/doctrine-bundle (v1.2.0)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 100%
     - Installing doctrine/doctrine-fixtures-bundle (dev-master 9a5b528)
       Downloading: connection...    Downloading: 0%               Downloading: 15%    Downloading: 30%    Downloading: 100%
     - Installing doctrine/orm (v2.4.6)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%    Downloading: 100%
     - Installing incenteev/composer-parameter-handler (v2.1.0)
       Downloading: connection...    Downloading: 0%               Downloading: 25%    Downloading: 50%    Downloading: 75%    Downloading: 100%
     - Installing knplabs/knp-components (1.3.1)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 100%
     - Installing knplabs/knp-paginator-bundle (2.4.1)
       Downloading: connection...    Downloading: 0%               Downloading: 20%    Downloading: 40%    Downloading: 60%    Downloading: 80%    Downloading: 100%
     - Installing knplabs/knp-snappy (0.2.1)
       Downloading: connection...    Downloading: 0%               Downloading: 35%    Downloading: 70%    Downloading: 100%
     - Installing knplabs/knp-snappy-bundle (dev-master 4e5a2cf)
       Downloading: connection...    Downloading: 0%               Downloading: 60%    Downloading: 95%    Downloading: 100%
     - Installing sensiolabs/security-checker (v2.0.0)
       Downloading: connection...    Downloading: 0%               Downloading: 90%    Downloading: 100%
     - Installing sensio/distribution-bundle (v3.0.8)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 95%    Downloading: 100%
     - Installing sensio/framework-extra-bundle (v3.0.2)
       Downloading: connection...    Downloading: 0%               Downloading: 15%    Downloading: 30%    Downloading: 40%    Downloading: 45%    Downloading: 55%    Downloading: 60%    Downloading: 70%    Downloading: 75%    Downloading: 85%    Downloading: 90%    Downloading: 100%
     - Installing kriswallsmith/assetic (v1.2.0)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%
     - Installing symfony/assetic-bundle (v2.5.0)
       Downloading: connection...    Downloading: 0%               Downloading: 10%    Downloading: 20%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 70%    Downloading: 80%    Downloading: 90%    Downloading: 100%
     - Installing monolog/monolog (1.11.0)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%    Downloading: 100%
     - Installing symfony/monolog-bundle (v2.6.1)
       Downloading: connection...    Downloading: 0%               Downloading: 15%    Downloading: 40%    Downloading: 55%    Downloading: 70%    Downloading: 85%    Downloading: 100%
     - Installing swiftmailer/swiftmailer (v5.3.0)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 10%    Downloading: 15%    Downloading: 20%    Downloading: 25%    Downloading: 30%    Downloading: 35%    Downloading: 40%    Downloading: 45%    Downloading: 50%    Downloading: 55%    Downloading: 60%    Downloading: 65%    Downloading: 70%    Downloading: 75%    Downloading: 80%    Downloading: 85%    Downloading: 90%    Downloading: 95%    Downloading: 100%    Downloading: 100%
     - Installing symfony/swiftmailer-bundle (v2.3.7)
       Downloading: connection...    Downloading: 0%               Downloading: 5%    Downloading: 25%    Downloading: 30%    Downloading: 55%    Downloading: 60%    Downloading: 85%    Downloading: 90%    Downloading: 100%
     - Installing twig/extensions (v1.2.0)
       Downloading: connection...    Downloading: 0%               Downloading: 10%    Downloading: 20%    Downloading: 30%    Downloading: 75%    Downloading: 100%
   Generating optimized autoload files
   Creating the "app/config/parameters.yml" file
   PHP Fatal error:  Class 'Sensio'Bundle'GeneratorBundle'SensioGeneratorBundle' not found in /tmp/build_634a4dfca497b3cefc3e87e3c0f3c462/app/AppKernel.php on line 30
   Script Sensio'Bundle'DistributionBundle'Composer'ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception

[运行时异常]
执行"cache:clear--no warm up"命令时出错。

install[-prefer source][-prefer dist][-dry-run][-dev][--no dev][-no-plugins][-no-custom installers][--no-scripts][-no-process][-v|vvv|-vverbose][-o|--optimize autoloader][-ignore platform reqs][packages1]。。。[包装N]

推送被拒绝,无法编译PHP应用程序enter code here

Heroku在推送时运行composer install --no-dev,因此不会安装任何开发包。

这意味着sensio/generator-bundle必须在require中列出,而不是在composer.json中列出require-dev(之后运行composer update以重新生成composer.lock并提交两者)。

还要确保在AppKernel.php中,捆绑包在仅在dev和test env中运行的if()块之外注册。

dev&prod模式。Composer以prod模式运行(例如--no-dev),但您的应用程序尝试以dev模式运行。

在Heroku:中设置ENV变量

SYMFONY_ENV=prod