尝试将我的symfony 3应用程序部署到heroku时,我有一个错误。
那是我的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的一部分:doctrine: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 :(得分:0)
我认为问题出在其中一个参数上:
{{1}}
我已将database_port更改为{{1}},因为通常应该使用它。您可以尝试将该设置为空吗?
另外,您能验证所有其他参数是否正确?是否有可以测试它们的Web访问界面。
数据库{{1}}是否也存在?这实际上可能会显示错误。