dpb56083
2015-11-19 19:31
浏览 5
已采纳

将Symfony2项目从localhost移至dev服务器

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:

 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.

My Symfony2 database parameters looks like:

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!

图片转代码服务由CSDN问答提供 功能建议

伙计们。 我知道这篇文章与编程没有完全相关。 但我真的需要别人的帮助。 所以我的问题是:

我有Symfony2应用程序,我将它从localhost移动到开发服务器,但我无法运行应用程序因为我的geeting错误: < pre> 致命错误:带有消息'SQLSTATE [HY000] [2003]的未捕获异常'PDOException'无法连接到/ var / www /中'xx.xx.xxx.xxx'(4)'上的MySQL服务器 第40行上的route / vendor / doctrine / dbal / lib / Doctrine / DBAL / Driver / PDOConnection.php

我试图在Stackoverflow和Internet中找到解决方案, 我发现mysql有配置文件阻塞外部资源并且只接受127.0.0.1地址,所以我按照描述的方式对这两行进行了评论这里

我的Symfony2数据库参数如下所示:

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

有人可以帮助我吗? 谢谢!

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • duangong0690 2015-11-19 20:07
    已采纳

    Check logs in app/logs/dev.log and/or you server logs.

    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? If so, how you've configured it?

    Probably it's not a serious issue, but we need more data.

    已采纳该答案
    评论
    解决 无用
    打赏 举报
  • douxi2670 2015-11-19 23:18

    +1 @Mateusz Sip

    You probably have a specific configuration or simply not have properly installed and configured mysql on your server.

    Also you should try to do mysql -u yourusername -p If it ask for your password , mysql is installed. Enter your password and let know us if you are correctly logged in.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题