dt614037527 2017-05-21 13:06
浏览 171

Codeigniter数据库连接错误和db_select

I'll try to be brief and to the point.

  1. I'm using Codeigniter 3.1.4. with HMVC
  2. Working perfectly on localhost with 'pconnect' = FALSE;
  3. Problem at live server through shared hosting.
  4. max_user_connections = 10. Set by the Hosting company.
  5. Also added mysql.allow_persistent = Off to php.ini file.
  6. Gives the error Message: mysqli::real_connect(): (42000/1203): User <user> already has more than 'max_user_connections' active connections Filename:mysqli/mysqli_driver.php Line Number: 201
  7. Line 201 is calling mysqli::real_connect within db_connect function of mysqli_driver
  8. CI's official statement is "...CodeIgniter intelligently takes care of closing your database connections".

With pconnect = FALSE; and CI's "intelligent" closing of database connections, I don't see what should be causing the problem.

EDIT

  • Was previously loading database groups through $this->load->database('group', TRUE); in each model (only one such call per model).
  • Tried resolving above error through autoloading 'database' library and setting $this->db->db_select('dbName'); in respective controllers+models but it's not always selecting the correct database when controller+model is loaded.
  • Does anyone know how db->db_select() works?

Any ideas would be great help. Thanks.

  • 写回答

1条回答 默认 最新

  • dongwo7858 2017-06-27 16:13
    关注

    Check your database setting inside applications/config folder.

    Somewhere you had mentioned mysql and somewhere mysqli.

    Remember current version of CodeIgniter doesn't support mysql.

    Hope it helps

    评论

报告相同问题?

悬赏问题

  • ¥100 求数学坐标画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
  • ¥15 名为“Product”的列已属于此 DataTable
  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 自己瞎改改,结果现在又运行不了了
  • ¥15 链式存储应该如何解决
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站