无法将我的symfony应用程序部署到heroku

时间:2017-07-21 14:15:07

标签: php symfony heroku

当我尝试将symfony应用程序部署到heroku时,部署失败,因为它无法连接到数据库。我创建了一个parameters.dist.yml文件,在部署期间由composer读取以创建parameters.yml文件。我已经确认参数是正确的,可以从我的本地机器连接到我的JawsDB数据库。我能做错什么?

请参阅以下heroku的回复:

if_this_role_is_editing_this_role

git push heroku master Counting objects: 736, done. Compressing objects: 100% (351/351), done. Writing objects: 100% (698/698), 808.13 KiB | 0 bytes/s, done. Total 698 (delta 340), reused 597 (delta 285) remote: Compressing source files... done. remote: Building source: remote: remote: -----> PHP app detected remote: -----> Bootstrapping... remote: -----> Installing platform packages... remote: - php (7.1.3) remote: - apache (2.4.20) remote: - nginx (1.8.1) remote: remote: ! WARNING: Your 'composer.lock' is not up to date with the latest remote: changes in 'composer.json'. To ensure you are not getting stale remote: dependencies, run 'composer update' on your machine and commit remote: any changes to Git before pushing again. remote: remote: -----> Installing dependencies... remote: Composer version 1.4.1 2017-03-10 09:29:45 remote: Loading composer repositories with package information remote: Installing dependencies from lock file remote: Package operations: 48 installs, 0 updates, 0 removals remote: - Installing crell/api-problem (2.0): Downloading (100%) remote: - Installing doctrine/lexer (v1.0.1): Loading from cache remote: - Installing doctrine/annotations (v1.2.7): Loading from cache remote: - Installing twig/twig (v1.32.0): Downloading (100%) remote: - Installing symfony/polyfill-util (v1.3.0): Downloading (100%) remote: - Installing paragonie/random_compat (v2.0.9): Downloading (100%) remote: - Installing symfony/polyfill-php70 (v1.3.0): Downloading (100%) remote: - Installing symfony/polyfill-php56 (v1.3.0): Downloading (100%) remote: - Installing symfony/polyfill-mbstring (v1.3.0): Downloading (100%) remote: - Installing symfony/symfony (v3.1.10): Downloading (100%) remote: - Installing symfony/polyfill-intl-icu (v1.3.0): Downloading (100%) remote: - Installing psr/log (1.0.2): Loading from cache remote: - Installing psr/cache (1.0.1): Loading from cache remote: - Installing doctrine/inflector (v1.1.0): Loading from cache remote: - Installing doctrine/collections (v1.3.0): Loading from cache remote: - Installing doctrine/cache (v1.6.1): Loading from cache remote: - Installing doctrine/common (v2.6.2): Downloading (100%) remote: - Installing doctrine/doctrine-cache-bundle (1.3.0): Loading from cache remote: - Installing zendframework/zend-eventmanager (3.0.1): Downloading (100%) remote: - Installing zendframework/zend-code (2.6.3): Downloading (100%) remote: - Installing ocramius/proxy-manager (1.0.2): Downloading (100%) remote: - Installing doctrine/dbal (v2.5.12): Downloading (100%) remote: - Installing doctrine/migrations (v1.5.0): Downloading (100%) remote: - Installing jdorn/sql-formatter (v1.2.17): Loading from cache remote: - Installing doctrine/doctrine-bundle (1.6.7): Downloading (100%) remote: - Installing doctrine/doctrine-migrations-bundle (v1.2.1): Downloading (100%) remote: - Installing doctrine/instantiator (1.0.5): Loading from cache remote: - Installing doctrine/orm (v2.5.6): Downloading (100%) remote: - Installing willdurand/negotiation (v2.2.1): Downloading (100%) remote: - Installing willdurand/jsonp-callback-validator (v1.1.0): Downloading (100%) remote: - Installing friendsofsymfony/rest-bundle (2.1.1): Downloading (100%) remote: - Installing incenteev/composer-parameter-handler (v2.1.2): Loading from cache remote: - Installing jms/metadata (1.6.0): Downloading (100%) remote: - Installing phpoption/phpoption (1.5.0): Downloading (100%) remote: - Installing jms/parser-lib (1.0.0): Downloading (100%) remote: - Installing phpcollection/phpcollection (0.5.0): Downloading (100%) remote: - Installing jms/serializer (1.5.0): Downloading (100%) remote: - Installing jms/serializer-bundle (1.2.0): Downloading (100%) remote: - Installing michelf/php-markdown (1.7.0): Downloading (100%) remote: - Installing nelmio/api-doc-bundle (2.13.1): Downloading (100%) remote: - Installing sensiolabs/security-checker (v4.0.1): Downloading (100%) remote: - Installing sensio/distribution-bundle (v5.0.18): Downloading (100%) remote: - Installing sensio/framework-extra-bundle (v3.0.23): Downloading (100%) remote: - Installing monolog/monolog (1.22.0): Downloading (100%) remote: - Installing symfony/monolog-bundle (v2.12.1): Downloading (100%) remote: - Installing symfony/polyfill-apcu (v1.3.0): Downloading (100%) remote: - Installing swiftmailer/swiftmailer (v5.4.6): Downloading (100%) remote: - Installing symfony/swiftmailer-bundle (v2.5.3): Downloading (100%) remote: Generating optimized autoload files remote: > Incenteev\ParameterHandler\ScriptHandler::buildParameters remote: Creating the "app/config/parameters.yml" file remote: > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap remote: > Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache remote: remote: remote: [Doctrine\DBAL\Exception\ConnectionException] remote: An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused remote: remote: remote: remote: [Doctrine\DBAL\Driver\PDOException] remote: SQLSTATE[HY000] [2002] Connection refused remote: remote: remote: remote: [PDOException] remote: SQLSTATE[HY000] [2002] Connection refused remote: remote: remote: Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception remote: remote: remote: [RuntimeException] remote: An error occurred when executing the "'cache:clear --no-warmup'" command: remote: remote: [Doctrine\DBAL\Exception\ConnectionException] remote: An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused remote: remote: remote: [Doctrine\DBAL\Driver\PDOException] remote: SQLSTATE[HY000] [2002] Connection refused remote: remote: remote: [PDOException] remote: SQLSTATE[HY000] [2002] Connection refused remote: remote: . 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: ! Push rejected, failed to compile PHP app. remote: remote: ! Push failed 似乎暗示它正在尝试连接到localhost但在我的parameters.yml文件中我已经包含了正确的连接细节。

1 个答案:

答案 0 :(得分:0)

看起来我正在尝试将主分支部署到herkou而不是活动分支。为了部署指定分支,我运行了:

git push heroku <branch>:master