我有一个codeigniter网站,我需要连接到phpmyadmin中的数据库。 这曾经起作用但不再适用。
尝试连接时出现的错误如下:
致命错误:未捕获错误:在D:\ Programming \ web \ Website_VB \ system \ database \ drivers \ mysql \ mysql_driver.php中调用未定义函数mysql_pconnect():92堆栈跟踪:#0 D:\ Programming \ web \ Website_VB \ system \ database \ DB_driver.php(116):CI_DB_mysql_driver-> db_pconnect()#1 D:\ Programming \ web \ Website_VB \ system \ database \ DB.php(149):CI_DB_driver-> initialize() #2 D:\ Programming \ web \ Website_VB \ system \ core \ Loader.php(347):DB(Array,NULL)#3 D:\ Programming \ web \ Website_VB \ system \ core \ Loader.php(1172): CI_Loader-> database()#4 D:\ Programming \ web \ Website_VB \ system \ core \ Loader.php(153):CI_Loader-> _ci_autoloader()#5 D:\ Programming \ web \ Website_VB \ system \ core \ Controller.php(52):CI_Loader-> initialize()#6 D:\ Programming \ web \ Website_VB \ application \ controllers \ home.php(19):CI_Controller-> __ construct()#7 D:\ Programming \ web \ Website_VB \ system \ core \ CodeIgniter.php(309):Home-> __ construct()#8 D:\ Programming \ web \ Website_VB \ index.php(202):require_once('D:\ Programming \。 ..')#9 {main}在第92行的D:\ Programming \ web \ Website_VB \ system \ database \ drivers \ mysql \ mysql_driver.php中抛出
在我的config \ database.php中,我有以下代码:
$active_group = 'default';
$active_record = TRUE;
$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'vbweb';
$db['default']['password'] = 'thepassword';
$db['default']['database'] = 'dbvb';
$db['default']['dbdriver'] = 'mysql';
$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;
我还使用“thepassword”作为密码创建了一个用户vbweb,并将其设置为所有权限
如果你想知道mysql_driver.php中有什么,它是以下内容:
function db_pconnect()
{
if ($this->port != '')
{
$this->hostname .= ':'.$this->port;
}
return @mysql_pconnect($this->hostname, $this->username, $this->password);
}
有谁知道如何修复此错误并连接到我的数据库?