信息不正确的Symfony2和GoDaddy错误消息 [英] Symfony2 and GoDaddy error message with incorrect information

查看:97
本文介绍了信息不正确的Symfony2和GoDaddy错误消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近将一个Symfony2项目上传到GoDaddy,但由于收到以下消息而无法访问该项目:

I recently uploaded a Symfony2 project to GoDaddy and I'm having trouble accesing it because I get the message:

An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'root'@'127.0.0.1' (using password: NO)

显然,该消息很清楚,所以我检查并重新检查了我的parameters.yml,该消息甚至与我那里的内容都不匹配,我已对其进行了多次更改以进行修复.这是我的parameters.yml:

Obviously the message is clear, so I checked and rechecked my parameters.yml, and the message don't even match what I have there, which I have changed several times to try to fix. This is my parameters.yml:

parameters:
    database_driver: pdo_mysql
    database_host: localhost
    database_port: null
    database_name: database1
    database_user: database1user
    database_password: mytestpassword
    mailer_transport: smtp
    mailer_host: 127.0.0.1
    mailer_user: null
    mailer_password: null
    locale: en
    secret: RandomTokenThatWillBeChanged
    debug_toolbar: true
    debug_redirects: false
    use_assetic_controller: true

因此,错误消息没有告诉我真正的问题是什么,或者是从尚未找到的某些缓存版本中加载参数.关于可能导致什么原因或该数据的缓存版本在哪里的任何想法?

So, the error message doesn't tell me what is my real problem, or it is loading the parameters from some cached version that I haven't found yet. Any ideas of what else could cause or where could a cached version of this data be?

推荐答案

开发Symfony应用程序的最佳实践之一是: 通过parameters.yml文件进行配置.它包含 信息,例如数据库名称,邮件程序主机名和自定义 配置参数.

One of the best practice when developing a Symfony application is to make it configurable via a parameters.yml file. It contains information such as the database name, the mailer hostname, and custom configuration parameters.

由于这些参数在您的本地计算机上可能不同,因此您的 测试环境,您的生产服务器,甚至之间 开发人员在同一个项目上工作,不建议存储 它在项目存储库中.相反,存储库应包含一个 带有合理默认值的paramaters.yml.dist文件可以用作 每个人的好起点.

As those parameters can be different on your local machine, your testing environment, your production servers, and even between developers working on the same project, it is not recommended to store it in the project repository. Instead, the repository should contain a paramaters.yml.dist file with sensible defaults that can be used as a good starting point for everyone.

然后,每当开发人员开始处理项目时, parameters.yml文件必须通过使用parameters.yml.dist创建 作为模板.效果很好,但是只要有新值 添加到模板后,您必须记住要更新主要参数 相应地归档.

Then, whenever a developer starts working on the project, the parameters`.yml file must be created by using the parameters.yml.dist as a template. That works quite well, but whenever a new value is added to the template, you must remember to update the main parameter file accordingly.

从Symfony 2.3开始,标准版随附了一个新捆绑包, 使繁琐的工作自动化.每当您运行composer install时, 脚本会创建parameters.yml文件(如果该文件不存在并且允许) 您可以交互式地自定义所有值.此外,如果您使用 --no-interaction标志,它将默默地回退到默认值 价值观.

As of Symfony 2.3, the Standard Edition comes with a new bundle that automates the tedious work. Whenever you run composer install, a script creates the parameters.yml file if it does not exist and allows you to customize all the values interactively. Moreover, if you use the --no-interaction flag, it will silently fallback to the default values.

http://symfony.com/blog/new-in-symfony-2-3-interactive-management-of-the-parameters-yml-file

因此,您的paramaters.yml是否不可能被paramaters.yml.dist覆盖?

So, is it not possible that your paramaters.yml is overwritten by paramaters.yml.dist?

您也可以尝试完全清除缓存
在开发中:

You can also try to completely clear the cache
In Dev:

php app/console cache:clear

生产中:

php app/console cache:clear --env=prod --no-debug

这篇关于信息不正确的Symfony2和GoDaddy错误消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆