mysql_pconnect()出错,Codeigniter错误:调用未定义函数mysql_pconnect()

I have updated my codeigniter version from 2.2.4 step by step to 3.0.6 and I get an error:

An uncaught Exception was encountered

Type: Error

Message: Call to undefined function mysql_pconnect()

Filename: path-to-project\system\database\drivers\mysql\mysql_driver.php

Line Number: 135

Backtrace:

File: path-to-project\application\controllers\Main.php

Line: 10

Function: __construct

File: path-to-project\index.php

Line: 315

Function: require_once

I have just replaced my index.php file and system directory with the new one and made some changes in my application according to tutorial.

and this is the Main controller:

class Main extends CI_Controller {

function __construct()

{

parent::__construct();

$this->load->model('main_model');

}

}

What causes the problem?!

And this is the link of the tutorial.

解决方案

Thanks to Anant

I come to a conclusion:

I completely changed my old database.php file in config folder with the new one:

From:

$db['default']['hostname'] = 'localhost';

$db['default']['username'] = '';

$db['default']['password'] = '';

$db['default']['database'] = '';

$db['default']['dbdriver'] = '';

$db['default']['dbprefix'] = '';

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

$db['default']['db_debug'] = TRUE;

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

$db['default']['cachedir'] = '';

$db['default']['char_set'] = 'utf8';

$db['default']['dbcollat'] = 'utf8_general_ci';

$db['default']['swap_pre'] = '';

$db['default']['autoinit'] = TRUE;

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

To:

$db['default'] = array(

'dsn' => '',

'hostname' => '',

'username' => '',

'password' => '',

'database' => '',

'dbdriver' => 'mysqli',

'dbprefix' => '',

'pconnect' => FALSE,

'db_debug' => (ENVIRONMENT !== 'production'),

'cache_on' => FALSE,

'cachedir' => '',

'char_set' => 'utf8',

'dbcollat' => 'utf8_general_ci',

'swap_pre' => '',

'encrypt' => FALSE,

'compress' => FALSE,

'stricton' => FALSE,

'failover' => array(),

'save_queries' => TRUE

);

And the error is gone!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值