Symfony2在生产时没有读取参数形式的parameter.yml文件

时间:2016-06-13 17:44:41

标签: mysql symfony doctrine centos6 symfony-2.8

星期一好!我有一个工作的Symfony2 Proyect,在我的计算机(MacOs)中开发,以前也部署在heroku中,但当我使用apache Vhost在CentOS中部署时。 我的网站有效但数据库连接不起作用。 我的parameters.yml文件:

# This file is auto-generated during the composer install
parameters:
    database_host: 127.0.0.1
    database_port: null
    database_name: dbname
    database_user: dbuser
    database_password: 8xFfdsaFDSCK

我的config.yml文件:

# Doctrine Configuration
doctrine:
    dbal:
        driver:   pdo_mysql
        host:     "%database_host%"
        port:     "%database_port%"
        dbname:   "%database_name%"
        user:     "%database_user%"
        password: "%database_password%"
        charset:  UTF8
        server_version: 5.6
        # if using pdo_sqlite as your database driver:
        #   1. add the path in parameters.yml
        #     e.g. database_path: "%kernel.root_dir%/data/data.db3"
        #   2. Uncomment database_path in parameters.yml.dist
        #   3. Uncomment next line:
        #     path:     "%database_path%"

    orm:
        auto_generate_proxy_classes: "%kernel.debug%"
        naming_strategy: doctrine.orm.naming_strategy.underscore
        auto_mapping: true

我的config_prod.yml

imports:
    - { resource: config.yml }

#framework:
#    validation:
#        cache: validator.mapping.cache.apc
#    serializer:
#        cache: serializer.mapping.cache.apc

#doctrine:
#    orm:
#        metadata_cache_driver: apc
#        result_cache_driver: apc
#        query_cache_driver: apc

monolog:
    handlers:
        main:
            type:         fingers_crossed
            action_level: error
            handler:      nested
        nested:
            type:  stream
            path:  "%kernel.logs_dir%/%kernel.environment%.log"
            level: debug
        console:
            type:  console

我在数据库连接上仍然出错:

[Doctrine\DBAL\Exception\ConnectionException]                                                                      
  An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user ''@'localhost' (using password: NO) 

告诉用户,密码和数据库我错过了什么?

0 个答案:

没有答案