2016-07-07 7 views
0

私のsymfony 3アプリケーションをherokuにデプロイしようとすると、エラーが発生します。私のsymfonyアプリケーションをHerokuにデプロイするときのDoctrine DBAL Exception ConnectionException

私parameters.yml.distです:

parameters: 
    database_host:  sql7.freemysqlhosting.net 
    database_port:  3306 
    database_name:  sql8125248 
    database_user:  sql8125248 
    database_driver: pdo_mysql 
    database_password: R2NgGhUjO8 
    # You should uncomment this if you want use pdo_sqlite 
    # database_path: "%kernel.root_dir%/data.db3" 

    mailer_transport: smtp 
    mailer_host:  127.0.0.1 
    mailer_user:  ~ 
    mailer_password: ~ 

    # A secret key that's used to generate certain security-related tokens 
    secret:   fsdfsdfs5d4f8ers6f1re98f46r54e1f498zef151zer54f 

そして、私のProcfile

web: $(composer config bin-dir)/heroku-php-apache2 web/ 

私config.ymlの一部:教義:DBAL:

# Doctrine Configuration 
driver: "%database_driver%" 
    host:  "%database_host%" 
    port:  "%database_port%" 
    dbname: "%database_name%" 
    user:  "%database_user%" 
    password: "%database_password%" 
    charset: UTF8 

gitコマンド実行後のトレース全体:git push heroku マスター事前に

remote:   
remote:   - Installing symfony/swiftmailer-bundle (v2.3.11) 
remote:   Downloading: 100% 
remote:   
remote:  Generating optimized autoload files 
remote:  > Incenteev\ParameterHandler\ScriptHandler::buildParameters 
remote:  Updating 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] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]... 
remote:   
remote: 
remote: !  Push rejected, failed to compile PHP app 
remote: 
remote: Verifying deploy... 
remote: 
remote: ! Push rejected to myapp. 
remote: 
To https://git.heroku.com/myapp.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to 'https://git.heroku.com/myapp.git' 

感謝。

答えて

0

私は、問題は、これらのパラメータの一つとなると信じて:

parameters: 
    database_host:  sql7.freemysqlhosting.net 
    database_port:  null 
    database_name:  sql8125248 
    database_user:  sql8125248 
    database_driver: pdo_mysql 
    database_password: R2NgGhUjO8 

通常それが使用されるべきものだので、私はnullにdatabase_portを変更しました。あなたはnullに設定してみることができますか?

また、他のすべてのパラメータが正しいことを確認できますか?それらをテストできるWebアクセスインターフェイスはありますか?

データベースsql8125248も実際に存在しますか?実際にはエラーが表示される可能性があります。

+0

よろしくお願いいたします。 私はそれを試して、数分であなたに知らせる。 –

+0

同じエラー@Alvin: "プッシュはmyappに拒否されました"。 freemysqlhosting.netの他のすべての無料データベースと同じように、phpmyadmin.coで見ることができるので、私の無料データベースがアクセス可能であることを知っています。 –

関連する問題