简体   繁体   English

从本地主机将Symfony2项目移至开发服务器

[英]Move Symfony2 project to dev server from localhost

guys. 伙计们 I know that post not fully related to programming. 我知道该帖子与编程不完全相关。 But I really need someone help. 但是我真的需要有人帮助。 So my problem is: 所以我的问题是:

I have Symfony2 application, I move it from localhost to development server with, but I cant run application because I geeting error: 我有Symfony2应用程序,我将其从localhost移至开发服务器,但由于我geeting错误而无法运行应用程序:

 Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2003] Can't connect to MySQL server on 'xx.xx.xxx.xxx' (4)' in /var/www/route/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php on line 40

I trying to find solution in Stackoverflow and in internet, I found that mysql has config file which blocking external resources and accept only 127.0.0.1 address, so I commented both lines as described here . 我试图在Stackoverflow和Internet中找到解决方案,但我发现mysql具有阻止外部资源并且仅接受127.0.0.1地址的配置文件,因此我在此处注释了两行。

My Symfony2 database parameters looks like: 我的Symfony2数据库参数如下所示:

parameters:
  database_driver: pdo_mysql
  database_host: localhost
  database_port: null
  database_name: db_name
  database_user: user
  database_password: pass

Can someone help to me? 有人可以帮我吗? Thanks! 谢谢!

Check logs in app/logs/dev.log and/or you server logs. 检查app / logs / dev.log中的日志和/或服务器日志。

Are you sure that hostname an user/password combination are correct? 您确定用户名/密码组合的主机名正确吗?

Where is your database? 您的数据库在哪里? If I understood it correctly, you have your own VPS? 如果我理解正确,那么您有自己的VPS吗? If so, how you've configured it? 如果是这样,您如何配置它?

Probably it's not a serious issue, but we need more data. 可能这不是一个严重的问题,但我们需要更多数据。

+1 @Mateusz Sip +1 @Mateusz Sip

You probably have a specific configuration or simply not have properly installed and configured mysql on your server. 您可能具有特定的配置,或者只是没有在服务器上正确安装和配置mysql。

Also you should try to do mysql -u yourusername -p If it ask for your password , mysql is installed. 另外,您应该尝试执行mysql -u yourusername -p如果要求输入密码,则会安装mysql。 Enter your password and let know us if you are correctly logged in. 输入您的密码,如果您正确登录,请告诉我们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM