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'
在此先感謝。
好的,謝謝你的回覆。 我嘗試一下,並在幾分鐘之內讓你知道。 –
同樣的錯誤@Alvin:「推送拒絕給myapp」。 知道我的免費數據庫是可訪問的,因爲我可以通過phpmyadmin.co查看它,因爲所有其他免費數據庫的freemysqlhosting.net。 –