致命错误:未捕获错误:在/ homepages /中调用未定义函数mysql_pconnect()

时间:2017-11-03 09:26:37

标签: php mysql apache

我正在尝试安装我的页面,但此错误是:

Fatal error: Uncaught Error: Call to undefined function mysql_pconnect() in /homepages/14/db1/htdocs/bonoboapp/system/database/drivers/mysql/mysql_driver.php:91 
Stack trace: #0 /homepages/14/db1/htdocs/bonoboapp/system/database/DB_driver.php(115): CI_DB_mysql_driver->db_pconnect() 
#1 /homepages/14/db1/htdocs/bonoboapp/system/database/DB.php(148): CI_DB_driver->initialize() 
#2 /homepages/14/db1/htdocs/bonoboapp/carpooling/core/MY_Router.php(111): DB() 
#3 /homepages/14/db1/htdocs/bonoboapp/carpooling/core/MY_Router.php(68): My_Router->_get_db_route('login') 
#4 /homepages/14/db1/htdocs/bonoboapp/system/core/Router.php(170): My_Router->_parse_routes() 
#5 /homepages/14/db1/htdocs/bonoboapp/system/core/CodeIgniter.php(173): CI_Router->_set_routing() 
#6 /homepages/14/db1/htdocs/bonoboapp/index.php(213): require_once('/homepages/14/d...') 
#7 {main} thrown in /homepages/14/db1/htdocs/bonoboapp/system/database/drivers/mysql/mysql_driver.php on line 91
你能帮忙吗?

1 个答案:

答案 0 :(得分:4)

我认为你正在使用Codeigniter,这个错误最有可能是使用他们的数据库类和驱动程序,因此你不会直接使用PHP的MySQL函数。

因此,您需要做的就是改变

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

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

database.php 文件

添加以下设置
$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
);