Symfony2 部署到 sh 平台失败。SQLSTATE [HY000] [2002]

Ula*_*oof 3 git deployment web-deployment symfony doctrine-orm

我在将 Symfony2 项目上传到 platform.sh 时遇到问题。我根据 symfony 文档一步一步完成了一切(我创建了 .platform.app.yaml、.platform/routes.yaml 和 .platform/services.yaml)。但是当我尝试将所有内容推送到 platform.sh master 分支时,我遇到了下面描述的问题。

 Generating runtime configuration.
  Found a `composer.json`, installing dependencies.

  Executing post-build hook...



      [Doctrine\DBAL\Exception\ConnectionException]                              
      An exception occured in driver: SQLSTATE[HY000] [2002] Connection refused  


      [Doctrine\DBAL\Driver\PDOException]        
      SQLSTATE[HY000] [2002] Connection refused  


      [PDOException]                             
      SQLSTATE[HY000] [2002] Connection refused  


  E: Unknown error in the toolstack: CalledProcessError: Command 'rm web/app_dev.php
  app/console --env=prod assetic:dump --no-debug
  ' returned non-zero exit status 1

E: Error building the project: Unable to build project, aborting deployment.
Run Code Online (Sandbox Code Playgroud)

它正在中止一切。我有一个我开发了 3 个月的项目,但我无法将其上传到任何地方......现在对我来说真的很困惑。

我读到,我应该更改parameters.yml,其中是数据库的学说设置。我的文件:

parameters:
    database_driver: pdo_mysql
    database_host: 127.0.0.1
    database_port: '3306'
    database_name: yoda_event
    database_user: root
    database_password: null
    mailer_transport: gmail
    mailer_host: ~
    mailer_user:     xxxxxxxxxxxxxxxxxxxxxxx
    mailer_password: xxxxxxxxxxxxxxxxxxxxxxx
    locale: en
    secret: xxxxxxxxxxxxxxxxxxx
    debug_toolbar: true
    debug_redirects: false
    use_assetic_controller: true
    assets_directory: 'assets'
Run Code Online (Sandbox Code Playgroud)

配置.yml:

imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: parameters_platform.php }

[...]

# Doctrine Configuration
doctrine:
    dbal:
        driver:   "%database_driver%"
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        # if using pdo_sqlite as your database driver, add the path in parameters.yml
        # e.g. database_path: "%kernel.root_dir%/data/data.db3"
        # path:     "%database_path%"
Run Code Online (Sandbox Code Playgroud)

问题是,如何正确设置 SQL 以将项目正确部署到 PLATFORM.SH?请提供任何提示我该如何解决这个问题。我已经尝试部署它两周了……我对此感到非常孤独。

我使用的是win7/64位,但是当我部署它时(至少)我将更改Linux系统。

Pau*_*eux 5

我遇到了同样的问题,因为 twig 已初始化并请求数据库以了解使用了哪个版本的 mysql。我通过在我的学说配置下添加以下内容解决了这个问题:

doctrine: dbal: [...] charset: UTF8 server_version: 5.6