我一直在使用Symfony 2.2进行一个项目,直到我尝试将其上传到实际网站时,它一直很顺利。现在我收到PDO连接错误:SQLSTATE [HY000] [2002]连接被拒绝
我的配置文件如下:
imports:
- { resource: parameters.yml }
- { resource: security.yml }
framework:
#esi: ~
#translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: %kernel.debug%
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: ~
translator: ~
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
# 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%
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
# app/config/config.yml
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: Account\UserBundle\Entity\User
对不起伙计们!忘了这个!
parameters:
database_driver: pdo_mysql
database_host: 127.0.0.1
database_port: null
database_name: convocloud
database_user: root
database_password: *****
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
locale: en
secret: ************************
database_path: null
我也向托管公司提出了一张票,他们很难过。我通常不会在这里发帖,非常绝望!再次感谢您的帮助!
答案 0 :(得分:1)
我确实是一只头晕目眩的鹅!
确保你跑:
php app/console doctrine:ensure-production-settings --no-debug --env=prod
在部署直播之前对不起,再次感谢您的帮助。