消息:配置的数据库连接是持久的。中止 [英] Message: Configured database connection is persistent. Aborting

查看:935
本文介绍了消息:配置的数据库连接是持久的。中止的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Codeigniter 2到3版本升级后,我得到这个错误..
为什么会是?



遇到未捕获的异常



类型:异常



消息:配置的数据库连接是持久的。正在中止。



文件名:/var/www/vhosts/xxx.com/app/system/libraries/Session/drivers/Session_database_driver.php



行号:94



Backtrace:



文件:/ var / www /vhosts/xxx.com/app/application/core/MY_Controller.php
行:11
功能:__construct



文件:/ var / www / vhosts / xxx.com / app / application / core / MY_Controller.php
Line:52
功能:__construct



/www/vhosts/xxx.com/app/application/controllers/Dashboard.php
行:7
功能:__construct



文件:/ var / www / vhosts / xxx.com / application / index.php
Line:293
功能:require_once

解决方案>

我有同样的问题,发现这只是一个更改设置的问题:



修改您的database.php配置文件,并将pconnect假。作为CI 3框架的一部分,它将是此数组的一部分:

  $ db ['default'] = array 
'pconnect'=> FALSE //此值
);

或者如果您的配置文件看起来更像CI 2版本:

  $ db ['default'] ['pconnect'] = FALSE; 

一点搜索似乎暗示数据库不喜欢持久连接,可能是因为安全原因。


Codeigniter 2 to 3 version after upgrading, I get this error.. Why would that be?

An uncaught Exception was encountered

Type: Exception

Message: Configured database connection is persistent. Aborting.

Filename: /var/www/vhosts/xxx.com/app/system/libraries/Session/drivers/Session_database_driver.php

Line Number: 94

Backtrace:

File: /var/www/vhosts/xxx.com/app/application/core/MY_Controller.php Line: 11 Function: __construct

File: /var/www/vhosts/xxx.com/app/application/core/MY_Controller.php Line: 52 Function: __construct

File: /var/www/vhosts/xxx.com/app/application/controllers/Dashboard.php Line: 7 Function: __construct

File: /var/www/vhosts/xxx.com/application/index.php Line: 293 Function: require_once

解决方案

I had the same issue, and found that it was just a matter of changing a setting:

Modify your database.php config file and turn 'pconnect' to false. As part of the CI 3 Framework, it would be part of this array:

$db['default'] = array(
    'pconnect' => FALSE // This value
);

Or if your config file looks more like the CI 2 version:

$db['default']['pconnect'] = FALSE;

A bit of searching seems to suggest that the database doesn't like a persistent connection, possible because of security reasons.

这篇关于消息:配置的数据库连接是持久的。中止的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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